Class: XRBP::ResultParserBase
- Inherits:
-
PluginBase
- Object
- PluginBase
- XRBP::ResultParserBase
- Defined in:
- lib/xrbp/plugins/result_parser.rb
Overview
Result Parser plugin base class, allows request results to be converted before returning / invoking callback.
Direct Known Subclasses
WebClient::Plugins::ResultParser, WebSocket::Plugins::ResultParser
Instance Attribute Summary collapse
-
#parser ⇒ Object
Returns the value of attribute parser.
Attributes inherited from PluginBase
Instance Method Summary collapse
Methods inherited from PluginBase
Constructor Details
This class inherits a constructor from XRBP::PluginBase
Instance Attribute Details
#parser ⇒ Object
Returns the value of attribute parser.
5 6 7 |
# File 'lib/xrbp/plugins/result_parser.rb', line 5 def parser @parser end |
Instance Method Details
#added ⇒ Object
7 8 9 10 11 12 |
# File 'lib/xrbp/plugins/result_parser.rb', line 7 def added plugin = self connection.define_instance_method(:parse_results) do |&bl| plugin.parser = bl end end |
#parse_result(res, req) ⇒ Object
14 15 16 17 |
# File 'lib/xrbp/plugins/result_parser.rb', line 14 def parse_result(res, req) return res unless parser parser.call(res, req) end |