Module: ActsAsScrubbable
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/acts_as_scrubbable.rb,
lib/acts_as_scrubbable/scrub.rb,
lib/acts_as_scrubbable/version.rb,
lib/acts_as_scrubbable/scrubbable.rb
Defined Under Namespace
Modules: Scrub, Scrubbable
Constant Summary collapse
- VERSION =
'1.0.2'
Class Method Summary collapse
- .add(key, value) ⇒ Object
- .after_hook(&block) ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .execute_after_hook ⇒ Object
- .scrub_map ⇒ Object
Class Method Details
.add(key, value) ⇒ Object
27 28 29 |
# File 'lib/acts_as_scrubbable.rb', line 27 def self.add(key, value) ActsAsScrubbable.scrub_map[key] = value end |
.after_hook(&block) ⇒ Object
19 20 21 |
# File 'lib/acts_as_scrubbable.rb', line 19 def self.after_hook(&block) @after_hook = block end |
.configure {|_self| ... } ⇒ Object
15 16 17 |
# File 'lib/acts_as_scrubbable.rb', line 15 def self.configure(&block) yield self end |
.execute_after_hook ⇒ Object
23 24 25 |
# File 'lib/acts_as_scrubbable.rb', line 23 def self.execute_after_hook @after_hook.call if @after_hook end |
.scrub_map ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/acts_as_scrubbable.rb', line 31 def self.scrub_map require 'faker' @_scrub_map ||= { :first_name => -> { Faker::Name.first_name }, :last_name => -> { Faker::Name.last_name }, :middle_name => -> { Faker::Name.name }, :name => -> { Faker::Name.name }, :email => -> { Faker::Internet.email }, :name_title => -> { Faker::Name.title }, :company_name => -> { Faker::Company.name }, :street_address => -> { Faker::Address.street_address }, :secondary_address => -> { Faker::Address.secondary_address }, :zip_code => -> { Faker::Address.zip_code }, :state_abbr => -> { Faker::Address.state_abbr }, :state => -> { Faker::Address.state }, :city => -> { Faker::Address.city }, :latitude => -> { Faker::Address.latitude }, :longitude => -> { Faker::Address.longitude }, :username => -> { Faker::Internet.user_name }, :boolean => -> { [true, false ].sample }, :school => -> { Faker::University.name } } end |