Module: Restful::Configuration::Configurable::ClassMethods
- Defined in:
- lib/restful/configuration.rb
Instance Method Summary collapse
- #option(name, *args) ⇒ Object
-
#register(*args) {|instance| ... } ⇒ Object
Constructor which takes a block, exposing the new instance for fine grained configuration.
Instance Method Details
#option(name, *args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/restful/configuration.rb', line 38 def option(name, *args) option = Restful::Configuration::Option.new(name, *args) self. << option class_eval do define_method(option.name) do config[option.name] end define_method(option.mutator_method) do |value| _was_explicitly_set(option.name) config[option.name] = option.generate_from(value) end end end |
#register(*args) {|instance| ... } ⇒ Object
Constructor which takes a block, exposing the new instance for fine grained configuration
32 33 34 35 36 |
# File 'lib/restful/configuration.rb', line 32 def register(*args, &block) instance = new(*args) yield(instance) if block_given? return instance end |