Class: BookmarkMachine::Bookmark
- Inherits:
-
Object
- Object
- BookmarkMachine::Bookmark
- Defined in:
- lib/bookmark_machine/bookmark.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#folders ⇒ Object
Returns the value of attribute folders.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Bookmarks are considered equal if all attributes are equal.
-
#initialize(url, attrs = nil) ⇒ Bookmark
constructor
A new instance of Bookmark.
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_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def description @description end |
#folders ⇒ Object
Returns the value of attribute folders.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def folders @folders end |
#icon ⇒ Object
Returns the value of attribute icon.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def icon @icon end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def name @name end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/bookmark_machine/bookmark.rb', line 3 def updated_at @updated_at end |
#url ⇒ Object
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 && == other. && description == other.description end |