Class: Harmony::Service::Message
- Inherits:
-
Object
- Object
- Harmony::Service::Message
- Defined in:
- lib/harmony/service/message.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(h = {}) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(h = {}) ⇒ Message
Returns a new instance of Message.
12 13 14 |
# File 'lib/harmony/service/message.rb', line 12 def initialize(h = {}) h.each {|k,v| instance_variable_set("@#{k}",v)} end |
Class Method Details
.attr_accessor(*vars) ⇒ Object
2 3 4 5 6 |
# File 'lib/harmony/service/message.rb', line 2 def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat vars super(*vars) end |
.attributes ⇒ Object
8 9 10 |
# File 'lib/harmony/service/message.rb', line 8 def self.attributes @attributes end |
.json_create(o) ⇒ Object
20 21 22 |
# File 'lib/harmony/service/message.rb', line 20 def self.json_create(o) new(*o['data']) end |
Instance Method Details
#attributes ⇒ Object
16 17 18 |
# File 'lib/harmony/service/message.rb', line 16 def attributes self.class.attributes || [] end |