Class: Rst::Status
- Inherits:
-
Object
- Object
- Rst::Status
- Defined in:
- lib/rst/status.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Status
constructor
A new instance of Status.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Status
Returns a new instance of Status.
5 6 7 8 |
# File 'lib/rst/status.rb', line 5 def initialize(params = {}) @username = cleanup_whitespace(params[:username]) @text = cleanup_whitespace(params[:text]) end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/rst/status.rb', line 3 def text @text end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/rst/status.rb', line 3 def username @username end |
Class Method Details
.parse(li) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/rst/status.rb', line 14 def self.parse(li) new( :username => li.css("span.user-text").text, :text => li.css("span.message-text").text ) end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/rst/status.rb', line 10 def to_s "#{@username}: #{@text}" end |