Class: SkypeArchive::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/skype_archive/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (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