class Drone::Plugin
Attributes
input[RW]
result[RW]
Public Class Methods
new(input) { |parse| ... }
click to toggle source
Initialize the plugin parser
@param input [String] the JSON as a string to parse @return [Drone::Plugin] the instance of that class
# File lib/drone/plugin.rb, line 31 def initialize(input) self.input = input yield( parse ) if block_given? end
Public Instance Methods
parse()
click to toggle source
Parse the provided payload
@return [Drone::Payload] the parsed payload within model @raise [Drone::InvalidJsonError] if the provided JSON is invalid
# 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