Module: Nuntius::Options::ClassMethods
- Defined in:
- lib/nuntius/configuration.rb
Instance Method Summary collapse
Instance Method Details
#option(name, default: nil, proc: false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nuntius/configuration.rb', line 6 def option(name, default: nil, proc: false) attr_writer(name) schema[name] = {default: default, proc: proc} if schema[name][:proc] define_method(name) do |*params| value = instance_variable_get(:"@#{name}") instance_exec(*params, &value) end else define_method(name) do instance_variable_get(:"@#{name}") end end end |
#schema ⇒ Object
22 23 24 |
# File 'lib/nuntius/configuration.rb', line 22 def schema @schema ||= {} end |