<commit_before># DOCS ARE UNDER CONSTRUCTION

## For now, the most usable feature of active tools is 'custom counters' - my implementation of <t>counter through</t> solution.

### Look here! Typical data structure

    class Country # has 'products_count' column
      ...
    end

    class MadeIn # has 'products_count' column
      belongs_to :country
      
      custom_counter_cache_for :country => {:made_ins_count => 1, :products_count => :products_count}
      
      # So, when MadeIn created/deleted, Country's 'made_ins_count' incremented/decremented by 1 and 'products_count' by MadeIn's 'products_count' value
      ...
    end

    class Category # has 'products_count' column
      acts_as_nested_set # has parent and children (!)

      custom_counter_cache_for "parent*" => {:children_count => 1, :products_count => :products_count}

      # So, when Category created/deleted, parent's 'children_count' incremented/decremented by 1 and 'products_count' by Category's 'products_count' value

    end

    class Brand # has 'products_count' column
      ...
    end

    class Product < ActiveRecord::Base
      belongs_to :category
      belongs_to :brand
      belongs_to :made_in
      
      custom_counter_cache_for :made_in => {:products_count => 1, :country => {:products_count => 1}}, :category => {:products_count => 1, "parent*" => {:products_count => 1}}, :brand => {:products_count => 1}
  
      # You can use nested options... it is very very useful :)
  
    end


# ActiveTools

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'active_tools'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install active_tools
<commit_msg>docs for custom_counter<commit_after># DOCS ARE UNDER CONSTRUCTION

## For now, the most usable feature of active tools is 'custom counters' - my implementation of <t>counter through</t> solution.

### Look here! Typical data structure

    class Country # has 'products_count' column
      ...
    end


    class MadeIn # has 'products_count' column
      belongs_to :country
      
      custom_counter_cache_for :country => {:made_ins_count => 1, :products_count => :products_count}
      
      # So, when MadeIn created/deleted, Country's 'made_ins_count' incremented/decremented by 1 and 'products_count' by MadeIn's 'products_count' value
      ...
    end


    class Category # has 'products_count' column
      acts_as_nested_set # has parent and children (!)

      custom_counter_cache_for "parent*" => {:children_count => 1, :products_count => :products_count}

      # So, when Category created/deleted, parent's 'children_count' incremented/decremented by 1 and 'products_count' by Category's 'products_count' value

    end


    class Brand # has 'products_count' column
      ...
    end


    class Product < ActiveRecord::Base
      belongs_to :category
      belongs_to :brand
      belongs_to :made_in
      
      custom_counter_cache_for :made_in => {:products_count => 1, :country => {:products_count => 1}}, :category => {:products_count => 1, "parent*" => {:products_count => 1}}, :brand => {:products_count => 1}
  
      # You can use nested options... it is very very useful :)
  
    end


# ActiveTools

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'active_tools'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install active_tools

{'fraction_non_alphanumeric': 0.09770114942528736, 'fraction_numerical': 0.005172413793103448, 'mean_word_length': 3.2711656441717794, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 39, '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': '7159746', 'n_tokens_mistral': 1055, 'n_tokens_neox': 984, 'n_words': 332}