Class: Ray::Payloads::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/ray/payloads/payload.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Payload

Returns a new instance of Payload.



7
# File 'lib/ray/payloads/payload.rb', line 7

def initialize(*args) end

Instance Method Details

#contentObject



13
14
15
# File 'lib/ray/payloads/payload.rb', line 13

def content
  {}
end

#get_originObject



25
26
27
# File 'lib/ray/payloads/payload.rb', line 25

def get_origin
  Origin::OriginFactory.new.get_origin
end

#to_hashObject



17
18
19
20
21
22
23
# File 'lib/ray/payloads/payload.rb', line 17

def to_hash
  {
    type: self.type,
    content: self.content,
    origin: self.get_origin.to_hash
  }
end

#typeObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/ray/payloads/payload.rb', line 9

def type
  raise NotImplementedError, 'You must define the `type` method in your Payload'
end