Class: GitHub::Payload::Formatter::Event

Inherits:
Object
  • Object
show all
Includes:
GitHub::Payload::Formatter
Defined in:
lib/github/payload/formatter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Event

Returns a new instance of Event.



45
46
47
# File 'lib/github/payload/formatter.rb', line 45

def initialize(payload)
  @payload = payload['payload']
end

Instance Attribute Details

#payloadObject

Returns the value of attribute payload.



44
45
46
# File 'lib/github/payload/formatter.rb', line 44

def payload
  @payload
end

Class Method Details

.objectify(hash) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/github/payload/formatter.rb', line 49

def self.objectify(hash)
  struct = OpenStruct.new
  hash.each do |key, value|
    struct.send("#{key}=", value.is_a?(Hash) ? objectify(value) : value)
  end
  struct
end