Class: Drone::Plugin
- Inherits:
-
Object
- Object
- Drone::Plugin
- Defined in:
- lib/drone/plugin.rb
Overview
Plugin payload parser for Drone
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(input) {|parse| ... } ⇒ Drone::Plugin
constructor
Initialize the plugin parser.
-
#parse ⇒ Drone::Payload
Parse the provided payload.
Constructor Details
#initialize(input) {|parse| ... } ⇒ Drone::Plugin
Initialize the plugin parser
31 32 33 34 35 36 37 |
# File 'lib/drone/plugin.rb', line 31 def initialize(input) self.input = input yield( parse ) if block_given? end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
24 25 26 |
# File 'lib/drone/plugin.rb', line 24 def input @input end |
#result ⇒ Object
Returns the value of attribute result.
25 26 27 |
# File 'lib/drone/plugin.rb', line 25 def result @result end |
Instance Method Details
#parse ⇒ Drone::Payload
Parse the provided payload
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/drone/plugin.rb', line 43 def parse self.result ||= Payload.new.tap do |payload| PayloadRepresenter.new( payload ).from_json( input ) end rescue MultiJson::ParseError raise InvalidJsonError end |