<commit_before># ContextBuilder

This gem provides a way of extending modules with context attributes.  Modules
that extend Context will receive the class method :context_attr which is
used to specify one or more context attributes that the extended module provides.
Each of these attributes will be accessible by name on classes that include the
extended module.  The value of that method is determined as the first non-nil
value from a hash provided to initialize_context or one of any number of lookup_NAME
methods in the class or any module included by the class.

## Installation

Add this line to your application's Gemfile:

    gem 'context_builder'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install context_builder

## Example

   module Personage

     extend ContextBuilder

     context_attr :name, :age
     context_attr(:race) { |options| options[:race] || options[:ethnicity] }

     def lookup_age
       ENV['AGE']
     end

   end

   class User

     include Personage

     def initialize(name)
       initialize_context(:name => name, :ethnicity => 'unknown')
     end

     def lookup_age
       'N/A' unless name == 'Greg'
     end

   end

   User.new('Fred').inspect
   >> #<User name=Fred age=N/A race=unknown>

   ENV['AGE'] = '27'
   User.new('Greg').inspect
   >> #<User name=Greg age=27 race=unknown>

## Usage Notes

It is important to place 'extend Context' AFTER any self.included methods
defined on the extended module.  Otherwise, the self.included method will
overwrite the one from Context, rendering the 'extend' useless.

## Contributing

1. Fork it ( https://github.com/[my-github-username]/context_builder/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request<commit_msg>Fix formatting issue with README.md<commit_after># ContextBuilder

This gem provides a way of extending modules with context attributes.  Modules
that extend Context will receive the class method :context_attr which is
used to specify one or more context attributes that the extended module provides.
Each of these attributes will be accessible by name on classes that include the
extended module.  The value of that method is determined as the first non-nil
value from a hash provided to initialize_context or one of any number of lookup_NAME
methods in the class or any module included by the class.

## Installation

Add this line to your application's Gemfile:

    gem 'context_builder'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install context_builder

## Example

   module Personage

     extend ContextBuilder

     context_attr :name, :age
     context_attr(:race) { |options| options[:race] || options[:ethnicity] }

     def lookup_age
       ENV['AGE']
     end

   end

   class User

     include Personage

     def initialize(name)
       initialize_context(:name => name, :ethnicity => 'unknown')
     end

     def lookup_age
       'N/A' unless name == 'Greg'
     end

   end

   User.new('Fred').inspect
   ### "#<User name=Fred age=N/A race=unknown>"

   ENV['AGE'] = '27'
   User.new('Greg').inspect
   ### "#<User name=Greg age=27 race=unknown>"

## Usage Notes

It is important to place 'extend Context' AFTER any self.included methods
defined on the extended module.  Otherwise, the self.included method will
overwrite the one from Context, rendering the 'extend' useless.

## Contributing

1. Fork it ( https://github.com/[my-github-username]/context_builder/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
{'fraction_non_alphanumeric': 0.08094742321707445, 'fraction_numerical': 0.004685059864653826, 'mean_word_length': 3.5533175355450237, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '4832239', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1029, 'n_words': 465}