Class: Declarative::Definitions::Definition
- Inherits:
-
Object
- Object
- Declarative::Definitions::Definition
- Defined in:
- lib/declarative/definitions.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(name, options = {}) ⇒ Definition
constructor
A new instance of Definition.
-
#merge(hash) ⇒ Object
TODO: should be called #copy.
-
#merge!(hash) ⇒ Object
TODO: this should return a new Definition instance.
Constructor Details
#initialize(name, options = {}) ⇒ Definition
Returns a new instance of Definition.
4 5 6 7 |
# File 'lib/declarative/definitions.rb', line 4 def initialize(name, ={}) @options = .dup @options[:name] = name.to_s end |
Instance Method Details
#[](name) ⇒ Object
9 10 11 |
# File 'lib/declarative/definitions.rb', line 9 def [](name) @options[name] end |
#merge(hash) ⇒ Object
TODO: should be called #copy.
18 19 20 |
# File 'lib/declarative/definitions.rb', line 18 def merge(hash) # TODO: should be called #copy. DeepDup.(@options).merge(hash) end |
#merge!(hash) ⇒ Object
TODO: this should return a new Definition instance.
13 14 15 16 |
# File 'lib/declarative/definitions.rb', line 13 def merge!(hash) # TODO: this should return a new Definition instance. @options.merge!(hash) self end |