<commit_before># ConditionalDelegate

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'conditional_delegate'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install conditional_delegate

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
<commit_msg>Add README.<commit_after># ConditionalDelegate

**ConditionalDelegate** allows delegates to be conditional.

## Installation

Add this line to your application's Gemfile:

    gem 'conditional_delegate'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install conditional_delegate

## Usage

Here is a short example with a parent and child class. Calls
to the child object are delegated to its parent if the
condition for that delegation is met.

Simple parent class with four accessors:

```ruby
class Parent
  attr_accessor :foo, :bar, :baz, :qux
end
```

Child class with the same accessors as the parent, and some
conditional delegates defined:

```ruby
class Child
  extend ConditionalDelegate

  attr_accessor :parent, :foo, :bar, :baz, :qux

  conditional_delegate :foo, to: :parent, if: :empty?
  conditional_delegate :bar, to: :parent, if: lambda { |value| value == "something" }

  conditional_delegate :baz, :qux, to: :parent, if: :empty?
end
```

The field `foo` is delegated to the parent if the value is `empty?`.

The field `bar` is delegated to the parent if the given lambda returns true for the child's `foo` value.

Both the fields `baz` and `qux` are delegated to the parent if the field's values are `empty?`.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

{'fraction_non_alphanumeric': 0.08742107819329771, 'fraction_numerical': 0.0048567265662943174, 'mean_word_length': 4.188916876574307, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3240335', 'n_tokens_mistral': 638, 'n_tokens_neox': 591, 'n_words': 282}