Class: USaidWat::Client::BaseRedditor
- Inherits:
-
Object
- Object
- USaidWat::Client::BaseRedditor
- Defined in:
- lib/usaidwat/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #age ⇒ Object
- #comment_karma ⇒ Object
- #comments ⇒ Object
- #created_at ⇒ Object
-
#initialize(username) ⇒ BaseRedditor
constructor
A new instance of BaseRedditor.
- #link_karma ⇒ Object
- #posts ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(username) ⇒ BaseRedditor
Returns a new instance of BaseRedditor.
17 18 19 |
# File 'lib/usaidwat/client.rb', line 17 def initialize(username) @username = username end |
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
15 16 17 |
# File 'lib/usaidwat/client.rb', line 15 def username @username end |
Instance Method Details
#age ⇒ Object
41 42 43 |
# File 'lib/usaidwat/client.rb', line 41 def age (Time.now - created_at).ago end |
#comment_karma ⇒ Object
33 34 35 |
# File 'lib/usaidwat/client.rb', line 33 def comment_karma about.comment_karma end |
#comments ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/usaidwat/client.rb', line 21 def comments user.comments(100) rescue NoMethodError raise NoSuchUserError, username rescue RuntimeError raise ReachabilityError end |
#created_at ⇒ Object
37 38 39 |
# File 'lib/usaidwat/client.rb', line 37 def created_at about.created_utc end |
#link_karma ⇒ Object
29 30 31 |
# File 'lib/usaidwat/client.rb', line 29 def link_karma about.link_karma end |
#posts ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/usaidwat/client.rb', line 49 def posts user.posts rescue NoMethodError raise NoSuchUserError, username rescue RuntimeError raise ReachabilityError end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/usaidwat/client.rb', line 45 def to_s "#{username}" end |