<commit_before>Adds a virtual attribute to models, that plays nice with forms etc


example:

    class MyModel < ActiveRecord::Base
      virtual_attribute :foo, :boolean => true, :attr_type => :attr_accessible
      virtual_attribute :bar, :boolean => true, :attr_type => :attr_accessible
    end

    params = {:foo => '1', :bar => 'false'}
    thing = MyModel.new(params)
  
    thing.foo #=>true
    thing.bar #=> false


Virtual attributes can be set to :boolean => true

  - This will parse ['yes', 'true', '1', 1] to be true
  - and ['no', 'false', '0', 0] to be false
  - otherwise will be nil
  
  - this allows them to be used transparently with checkboxes etc in forms

If using attr_accessible in your model, the virtual attribute should be added to the list to, or you can pass:

    :attr_type => :attr_accessible as an option as shown above

Will document better later, until then:
  phil at latentflip dot com

<commit_msg>Updated readme even more<commit_after>Adds a virtual attribute to models, that plays nice with forms etc


example:

    class MyModel < ActiveRecord::Base
      virtual_attribute :foo, :boolean => true, :attr_type => :attr_accessible
      virtual_attribute :bar, :boolean => true, :attr_type => :attr_accessible
    end

    params = {:foo => '1', :bar => 'false'}
    thing = MyModel.new(params)
  
    thing.foo #=>true
    thing.bar #=> false


Virtual attributes can be set to :boolean => true

  - This will parse ['yes', 'true', '1', 1] to be true
  - and ['no', 'false', '0', 0] to be false
  - otherwise will be nil
  - this allows them to be used transparently with checkboxes etc in forms

If using attr_accessible in your model, the virtual attribute should be added to the list to, or you can pass:

    :attr_type => :attr_accessible as an option as shown above

Will document better later, until then:
  phil at latentflip dot com


{'fraction_non_alphanumeric': 0.09745762711864407, 'fraction_numerical': 0.005296610169491525, 'mean_word_length': 3.465721040189125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3242281', 'n_tokens_mistral': 569, 'n_tokens_neox': 539, 'n_words': 245}