Class: Most::DI::Service
- Includes:
- Observable
- Defined in:
- lib/most/di/service.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(definition = default_definition()) ⇒ Service
constructor
A new instance of Service.
- #nil? ⇒ Boolean
Constructor Details
#initialize(definition = default_definition()) ⇒ Service
29 30 31 |
# File 'lib/most/di/service.rb', line 29 def initialize(definition = default_definition()) @definition = definition; state_update() end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
27 28 29 |
# File 'lib/most/di/service.rb', line 27 def definition @definition end |
Instance Method Details
#[](key) ⇒ Object
33 34 35 |
# File 'lib/most/di/service.rb', line 33 def [](key) @definition[key] end |
#[]=(key, value) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/most/di/service.rb', line 37 def []=(key, value) result = nil previous_value = @definition[key] result = @definition[key] = value state_update() if previous_value != value result end |
#nil? ⇒ Boolean
48 49 50 |
# File 'lib/most/di/service.rb', line 48 def nil?() @definition.nil? end |