Class: BookmarkMachine::Bookmark

Inherits:
Object
  • Object
show all
Defined in:
lib/bookmark_machine/bookmark.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, attrs = nil) ⇒ Bookmark

Returns a new instance of Bookmark.



5
6
7
8
9
10
11
12
13
14
# File 'lib/bookmark_machine/bookmark.rb', line 5

def initialize(url, attrs=nil)
  self.url = url

  if attrs
    attrs.each{|key,value| self.send("#{key}=", value)}
  end

  self.name    ||= ""
  self.folders ||= []
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def description
  @description
end

#foldersObject

Returns the value of attribute folders.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def folders
  @folders
end

#iconObject

Returns the value of attribute icon.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def icon
  @icon
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def name
  @name
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def tags
  @tags
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def updated_at
  @updated_at
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/bookmark_machine/bookmark.rb', line 3

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object

Bookmarks are considered equal if all attributes are equal. Which is probably what you would have excpected.



18
19
20
21
22
23
24
25
26
27
# File 'lib/bookmark_machine/bookmark.rb', line 18

def == other
  url         == other.url &&
  name        == other.name &&
  created_at  == other.created_at &&
  updated_at  == other.updated_at &&
  icon        == other.icon &&
  folders     == other.folders &&
  tags        == other.tags &&
  description == other.description
end