Class: JYRon::Mediator
- Inherits:
-
Object
- Object
- JYRon::Mediator
- Defined in:
- lib/jyron/mediator.rb
Defined Under Namespace
Classes: MediatorOptionsFailure
Constant Summary
Constants included from Inputs
Inputs::CLI_INPUTS, Inputs::INPUTS_LIST
Constants included from Outputs
Outputs::CLI_OUTPUTS, Outputs::OUTPUTS_LIST
Constants included from Filters
Constants included from Adapters
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
- #from_obj(obj) ⇒ Object
-
#initialize(options = {}) ⇒ Mediator
constructor
A new instance of Mediator.
- #to_obj ⇒ Object
Methods included from Inputs
#from_json, #from_rb, #from_yaml
Methods included from Outputs
Methods included from Filters
Constructor Details
#initialize(options = {}) ⇒ Mediator
Returns a new instance of Mediator.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jyron/mediator.rb', line 11 def initialize( = {}) @adapters = [] if [:adapters] then @adapters.push([:adapters]).flatten! if [:adapters] .delete(:adapters) end from = INPUTS_LIST & .keys raise MediatorOptionsFailure if from.size > 2 self.send from.first, [from.first] if from.size == 1 adapt unless @object.nil? end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
3 4 5 |
# File 'lib/jyron/mediator.rb', line 3 def object @object end |
Instance Method Details
#from_obj(obj) ⇒ Object
25 26 27 28 29 |
# File 'lib/jyron/mediator.rb', line 25 def from_obj(obj) @object = obj adapt return self end |
#to_obj ⇒ Object
32 33 34 |
# File 'lib/jyron/mediator.rb', line 32 def to_obj return @object end |