<commit_before># Mascherari

An easy way to handle masks.

## Installation

Add this line to your application's Gemfile:

    gem 'mascherari'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mascherari

## Usage

To create masks for your attributes, extend Mascherari::AttrMasked to your class and set the format:

```ruby
class Person
  extend Mascherari::AttrMasked

  attr_accessor :phone

  attr_masked :phone, :format => "(##) ####-####"
end
```

You can also extend Mascherari::AttrMasked to your Rails models:

```ruby
# config/initializers/mascherari.rb
ActiveSupport.on_load :active_record do
  extend Mascherari::AttrMasked
end

# app/models/person.rb
class Person < ActiveRecord::Base
  attr_masked :phone, :format => "(##) ####-####"
end
```

That will give you two methods to use along with your objects:

```ruby
# person.phone = "555412035"
person.phone_masked
=> "(55) 5421-2035"

# person.phone = "(55) 5421-2035"
person.phone_unmasked
=> "555412035"
```

You can also use the stand alone formatter to create formats and apply as you want:

```ruby
phone_format = Mascherari::Formatter.new :format => "(##) ####-####"

phone_format.mask "555412035"
=> "(55) 5421-2035"

phone_format.unmask "(99) 3343-1205"
=> "9933431205"
```

## Contributing

1. Fork it
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 new Pull Request<commit_msg>Add work in progress message<commit_after># Mascherari

An easy way to handle masks. (Work in progress)

## Installation

Add this line to your application's Gemfile:

    gem 'mascherari'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mascherari

## Usage

To create masks for your attributes, extend Mascherari::AttrMasked to your class and set the format:

```ruby
class Person
  extend Mascherari::AttrMasked

  attr_accessor :phone

  attr_masked :phone, :format => "(##) ####-####"
end
```

You can also extend Mascherari::AttrMasked to your Rails models:

```ruby
# config/initializers/mascherari.rb
ActiveSupport.on_load :active_record do
  extend Mascherari::AttrMasked
end

# app/models/person.rb
class Person < ActiveRecord::Base
  attr_masked :phone, :format => "(##) ####-####"
end
```

That will give you two methods to use along with your objects:

```ruby
# person.phone = "555412035"
person.phone_masked
=> "(55) 5421-2035"

# person.phone = "(55) 5421-2035"
person.phone_unmasked
=> "555412035"
```

You can also use the stand alone Formatter to create formats and apply as you want:

```ruby
phone_format = Mascherari::Formatter.new :format => "(##) ####-####"

phone_format.mask "555412035"
=> "(55) 5421-2035"

phone_format.unmask "(99) 3343-1205"
=> "9933431205"
```

## Contributing

1. Fork it
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 new Pull Request
{'fraction_non_alphanumeric': 0.1322099805573558, 'fraction_numerical': 0.053143227478937134, 'mean_word_length': 4.454063604240282, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '691031', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1033, 'n_words': 346}