Class: InstaReadability::Bookmark
- Inherits:
-
Object
- Object
- InstaReadability::Bookmark
- Defined in:
- lib/insta_readability/bookmark.rb
Constant Summary collapse
- ATTRIBUTES =
[:url, :favorite, :archive, :allow_duplicates]
Instance Method Summary collapse
- #==(o) ⇒ Object (also: #eql?)
-
#initialize(options = {}) ⇒ Bookmark
constructor
A new instance of Bookmark.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Bookmark
Returns a new instance of Bookmark.
6 7 8 9 |
# File 'lib/insta_readability/bookmark.rb', line 6 def initialize(={}) @archive, @favorite, @allow_duplicates = 0, 0, 0 .each_pair { |attr, value| instance_variable_set("@#{attr}", value) } end |
Instance Method Details
#==(o) ⇒ Object Also known as: eql?
11 12 13 |
# File 'lib/insta_readability/bookmark.rb', line 11 def ==(o) o.class == self.class && o.to_hash == to_hash end |
#to_hash ⇒ Object
16 17 18 19 20 21 |
# File 'lib/insta_readability/bookmark.rb', line 16 def to_hash ATTRIBUTES.inject({}) do |hash, attribute| hash[attribute] = self.send attribute.to_s hash end end |