Class: Mashfeed::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/mashfeed/statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_entriesObject

Returns the value of attribute input_entries.



3
4
5
# File 'lib/mashfeed/statement.rb', line 3

def input_entries
  @input_entries
end

#inputsObject

Returns the value of attribute inputs.



3
4
5
# File 'lib/mashfeed/statement.rb', line 3

def inputs
  @inputs
end

#pluginObject (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