Class: Rdayone::Entry

Inherits:
Object
  • Object
show all
Includes:
AttributeMappable
Defined in:
lib/rdayone/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeMappable

#method_missing

Constructor Details

#initialize(plist_hash = {}, photo = nil) ⇒ Entry

Returns a new instance of Entry.



7
8
9
10
11
12
13
14
15
# File 'lib/rdayone/entry.rb', line 7

def initialize(plist_hash = {}, photo = nil)
  @plist_hash = plist_hash
  @photo = photo
  @attribute_mappings = {
    :text => "Entry Text",
    :creation_date => "Creation Date",
    :identifier => "UUID"
  }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rdayone::AttributeMappable

Instance Attribute Details

#attribute_mappingsObject (readonly)

Returns the value of attribute attribute_mappings.



3
4
5
# File 'lib/rdayone/entry.rb', line 3

def attribute_mappings
  @attribute_mappings
end

#photoObject (readonly)

Returns the value of attribute photo.



3
4
5
# File 'lib/rdayone/entry.rb', line 3

def photo
  @photo
end

#plist_hashObject (readonly)

Returns the value of attribute plist_hash.



3
4
5
# File 'lib/rdayone/entry.rb', line 3

def plist_hash
  @plist_hash
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
# File 'lib/rdayone/entry.rb', line 17

def <=>(other)
  self.creation_date <=> other.creation_date
end

#locationObject



21
22
23
# File 'lib/rdayone/entry.rb', line 21

def location
  Location.new(@plist_hash["Location"])
end