<commit_before>Feature: Reference decorator and decorated methods by name
  
  Both decorator and decorated methods may be referenced by name, as either 
  {Symbol} or {String} instances. The referenced methods may be instance or 
  singleton (class) methods, as long as they are unambiguous.
  
  
  Background:
    
    I will use the same simple class named {A} to demonstrate each scenario.
    
    The first things to notice is the I need to `require` the {NRSER::Decorate}
    module, and also *extend* it into {A}, making it's methods available as
    singleton methods.
    
    {A} contains each a singleton and instance decorator method, as well as 
    singleton and instance target methods that I will decorate.
    
    And a class:
      """ruby
      
      require 'nrser/decorate'
      
      class A
        
        extend NRSER::Decorate
        
        def self.singleton_decorator receiver, target, *args, &block
          <<~END
            A.singleton_decorator called #{ target.name } and it said:
            #{ target.call( *args, &block ) }
          END
        end
        
        def self.singleton_target
          "Hi from A.singleton_target"
        end
        
        def instance_decorator receiver, target, *args, &block
          <<~END
            A#instance_decorator called #{ target.name } and it said:
            #{ target.call( *args, &block ) }
          END
        end
        
        def instance_target
          "Hi from A#instance_target"
        end
        
      end
      """
  
  
  Scenario: (1) *Bare* names default to instance methods with `#decorate`
    
    Using {NRSER::Decorate#decorate}, methods that are referenced by "bare"
    name - {String} or {Symbol} without a preceeding '.' or '#' to indicate
    that they are singleton or instance methods - are assumed to be instance
    methods.
    
    Given I evaluate the following in the class {A}:
      """ruby
        decorate :instance_decorator, :instance_target
      """
    
    When I create a new instance of {A} with no parameters
    And I call `instance_target` with no parameters
    
    Then the response is equal to:
      """ruby
        <<~END
          A#instance_decorator called instance_target and it said:
          Hi from A#instance_target
        END
      """
    
    
  Scenario: (2) *Bare* names default to instance methods with `#singleton_decorate`
    
    Using {NRSER::Decorate#decorate_singleton}, methods that are referenced
    by "bare" name - {String} or {Symbol} without a preceeding '.' or '#' to
    indicate that they are singleton or instance methods - are assumed to be<commit_msg>Spelling<commit_after>Feature: Reference decorator and decorated methods by name
  
  Both decorator and decorated methods may be referenced by name, as either 
  {Symbol} or {String} instances. The referenced methods may be instance or 
  singleton (class) methods, as long as they are unambiguous.
  
  
  Background:
    
    I will use the same simple class named {A} to demonstrate each scenario.
    
    The first things to notice is the I need to `require` the {NRSER::Decorate}
    module, and also *extend* it into {A}, making it's methods available as
    singleton methods.
    
    {A} contains each a singleton and instance decorator method, as well as 
    singleton and instance target methods that I will decorate.
    
    And a class:
      """ruby
      
      require 'nrser/decorate'
      
      class A
        
        extend NRSER::Decorate
        
        def self.singleton_decorator receiver, target, *args, &block
          <<~END
            A.singleton_decorator called #{ target.name } and it said:
            #{ target.call( *args, &block ) }
          END
        end
        
        def self.singleton_target
          "Hi from A.singleton_target"
        end
        
        def instance_decorator receiver, target, *args, &block
          <<~END
            A#instance_decorator called #{ target.name } and it said:
            #{ target.call( *args, &block ) }
          END
        end
        
        def instance_target
          "Hi from A#instance_target"
        end
        
      end
      """
  
  
  Scenario: (1) *Bare* names default to instance methods with `#decorate`
    
    Using {NRSER::Decorate#decorate}, methods that are referenced by "bare"
    name - {String} or {Symbol} without a preceding '.' or '#' to indicate
    that they are singleton or instance methods - are assumed to be instance
    methods.
    
    Given I evaluate the following in the class {A}:
      """ruby
        decorate :instance_decorator, :instance_target
      """
    
    When I create a new instance of {A} with no parameters
    And I call `instance_target` with no parameters
    
    Then the response is equal to:
      """ruby
        <<~END
          A#instance_decorator called instance_target and it said:
          Hi from A#instance_target
        END
      """
    
    
  Scenario: (2) *Bare* names default to instance methods with `#singleton_decorate`
    
    Using {NRSER::Decorate#decorate_singleton}, methods that are referenced
    by "bare" name - {String} or {Symbol} without a preceeding '.' or '#' to
    indicate that they are singleton or instance methods - are assumed to be
{'fraction_non_alphanumeric': 0.0709433962264151, 'fraction_numerical': 0.0007547169811320754, 'mean_word_length': 2.176153385260635, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6334562', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1424, 'n_words': 579}