Class: SkypeArchive::Message
- Inherits:
-
Object
- Object
- SkypeArchive::Message
- Defined in:
- lib/skype_archive/message.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Message
constructor
A new instance of Message.
- #method_missing(method, *args, &block) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 |
# File 'lib/skype_archive/message.rb', line 5 def initialize(attributes={}) @attributes = attributes @timestamp = @attributes.delete(:timestamp) @attributes[:created_at] = Time.at(@timestamp) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
15 16 17 |
# File 'lib/skype_archive/message.rb', line 15 def method_missing(method, *args, &block) @attributes[method.to_sym] or super end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/skype_archive/message.rb', line 3 def attributes @attributes end |
Instance Method Details
#to_json(*opts) ⇒ Object
11 12 13 |
# File 'lib/skype_archive/message.rb', line 11 def to_json(*opts) @attributes.to_json(*opts) end |