Class: EDango::DI::Service
- Includes:
- Observable
- Defined in:
- lib/edango/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 = nil) ⇒ Service
constructor
A new instance of Service.
- #nil? ⇒ Boolean
Constructor Details
#initialize(definition = nil) ⇒ Service
Returns a new instance of Service.
29 30 31 32 |
# File 'lib/edango/di/service.rb', line 29 def initialize(definition = nil) @definition = definition || default_definition state_update() end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
27 28 29 |
# File 'lib/edango/di/service.rb', line 27 def definition @definition end |
Instance Method Details
#[](key) ⇒ Object
34 35 36 |
# File 'lib/edango/di/service.rb', line 34 def [](key) @definition[key] end |
#[]=(key, value) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/edango/di/service.rb', line 38 def []=(key, value) previous_value, @definition[key] = @definition[key], value state_update() if previous_value != value value end |
#nil? ⇒ Boolean
45 46 47 |
# File 'lib/edango/di/service.rb', line 45 def nil? @definition.nil? end |