Class: Mashfeed::Statement
- Inherits:
-
Object
- Object
- Mashfeed::Statement
- Defined in:
- lib/mashfeed/statement.rb
Instance Attribute Summary collapse
-
#input_entries ⇒ Object
Returns the value of attribute input_entries.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Instance Method Summary collapse
- #execute(items = nil) ⇒ Object
-
#initialize(plugin, inputs = []) ⇒ Statement
constructor
A new instance of Statement.
- #input(*statements) ⇒ Object
-
#method_missing(name, *args) ⇒ Object
unknow methods delegate to @plugin.
Constructor Details
#initialize(plugin, inputs = []) ⇒ Statement
Returns a new instance of Statement.
6 7 8 |
# File 'lib/mashfeed/statement.rb', line 6 def initialize(plugin, inputs=[]) @plugin, @inputs, @input_entries = plugin, inputs, [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
unknow methods delegate to @plugin
19 20 21 |
# File 'lib/mashfeed/statement.rb', line 19 def method_missing(name, *args) @plugin.send(name, *args) end |
Instance Attribute Details
#input_entries ⇒ Object
Returns the value of attribute input_entries.
3 4 5 |
# File 'lib/mashfeed/statement.rb', line 3 def input_entries @input_entries end |
#inputs ⇒ Object
Returns the value of attribute inputs.
3 4 5 |
# File 'lib/mashfeed/statement.rb', line 3 def inputs @inputs end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
4 5 6 |
# File 'lib/mashfeed/statement.rb', line 4 def plugin @plugin end |
Instance Method Details
#execute(items = nil) ⇒ Object
14 15 16 |
# File 'lib/mashfeed/statement.rb', line 14 def execute(items=nil) @plugin.execute(items || self.input_entries.flatten) end |
#input(*statements) ⇒ Object
10 11 12 |
# File 'lib/mashfeed/statement.rb', line 10 def input(*statements) @inputs += statements end |