Class: Vop::Filter
- Inherits:
-
Object
- Object
- Vop::Filter
- Defined in:
- lib/vop/objects/filter.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Instance Method Summary collapse
- #execute(request) ⇒ Object
-
#initialize(plugin, name) ⇒ Filter
constructor
A new instance of Filter.
- #short_name ⇒ Object
Constructor Details
#initialize(plugin, name) ⇒ Filter
Returns a new instance of Filter.
10 11 12 13 |
# File 'lib/vop/objects/filter.rb', line 10 def initialize(plugin, name) @plugin = plugin @name = name end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
8 9 10 |
# File 'lib/vop/objects/filter.rb', line 8 def block @block end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/vop/objects/filter.rb', line 7 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/vop/objects/filter.rb', line 5 def name @name end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
5 6 7 |
# File 'lib/vop/objects/filter.rb', line 5 def plugin @plugin end |
Instance Method Details
#execute(request) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vop/objects/filter.rb', line 19 def execute(request) # this executor is just to prepare payload ex = Executor.new(@plugin.op) context = {} block_param_names = self.block.parameters.map { |x| x.last } payload = ex.prepare_payload(request, context, block_param_names) response = nil begin response = self.block.call(*payload) rescue InterruptChain => ic response = ic.response end response end |
#short_name ⇒ Object
15 16 17 |
# File 'lib/vop/objects/filter.rb', line 15 def short_name @name.split(".").last end |