Class: Fakerize::Configuration
- Inherits:
-
Object
- Object
- Fakerize::Configuration
- Defined in:
- lib/fakerize/configuration.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Configuration
constructor
config = { email: ->() { Faker::Internet.email }, first_name: ->() { Faker::Name.first_name }, last_name: ->() { Faker::Name.last_name } }.
Constructor Details
#initialize(config) ⇒ Configuration
config = {
email: ->() { Faker::Internet.email },
first_name: ->() { Faker::Name.first_name },
last_name: ->() { Faker::Name.last_name }
}
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fakerize/configuration.rb', line 12 def initialize(config) @config = config @attributes = config.keys attributes.each do |attribute| define_singleton_method attribute do config[attribute] end end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
2 3 4 |
# File 'lib/fakerize/configuration.rb', line 2 def attributes @attributes end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
2 3 4 |
# File 'lib/fakerize/configuration.rb', line 2 def config @config end |