Class: Rst::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/rst/status.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/rst/status.rb', line 3

def text
  @text
end

#usernameObject (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_sObject



10
11
12
# File 'lib/rst/status.rb', line 10

def to_s
  "#{@username}: #{@text}"
end