Class: ConfigX::Interface::Builder
- Inherits:
-
Object
- Object
- ConfigX::Interface::Builder
- Defined in:
- lib/config_x/interface/builder.rb
Instance Method Summary collapse
- #attr(name, opts = {}, &block) ⇒ Object
- #build(&block) ⇒ Object
-
#initialize(config_interface, owner_interface, namespace = [], store_map = {}) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(config_interface, owner_interface, namespace = [], store_map = {}) ⇒ Builder
Returns a new instance of Builder.
4 5 6 7 8 9 |
# File 'lib/config_x/interface/builder.rb', line 4 def initialize(config_interface, owner_interface, namespace = [], store_map = {}) @config_interface = config_interface @owner_interface = owner_interface @namespace = namespace @store_map = store_map end |
Instance Method Details
#attr(name, opts = {}, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/config_x/interface/builder.rb', line 16 def attr(name, opts = {}, &block) name = name.to_s validate_attr_name(name) if block define_nested_attr_interface(name, opts, &block) else define_attr_interface(name, opts, &block) end end |
#build(&block) ⇒ Object
11 12 13 14 |
# File 'lib/config_x/interface/builder.rb', line 11 def build(&block) instance_exec(&block) @store_map end |