Class: RedditKit::Thing
Overview
A base class for objects which have both a kind and an identifier.
Direct Known Subclasses
Comment, Link, ModeratorAction, PrivateMessage, Subreddit, User
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#full_name ⇒ Object
Returns the object’s full name.
Methods inherited from Base
Constructor Details
This class inherits a constructor from RedditKit::Base
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/redditkit/thing.rb', line 8 def id @id end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
9 10 11 |
# File 'lib/redditkit/thing.rb', line 9 def kind @kind end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 |
# File 'lib/redditkit/thing.rb', line 11 def ==(other) return false unless other.is_a?(Thing) full_name == other.full_name end |
#full_name ⇒ Object
Returns the object’s full name.
17 18 19 |
# File 'lib/redditkit/thing.rb', line 17 def full_name @full_name ||= "#{kind}_#{id}" end |