Class: Nerdz::Post
- Inherits:
-
Object
- Object
- Nerdz::Post
- Defined in:
- lib/nerdz/structs.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(h) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(h) ⇒ Post
Returns a new instance of Post.
32 33 34 35 36 37 38 |
# File 'lib/nerdz/structs.rb', line 32 def initialize(h) @to = User.new(h['to'], h['to_user']) @from = User.new(h['from'], h['from_user']) @pid = h['pid'].to_i rescue nil @message = h['message'] @time = Time.mktime(*(h['date'].split(?/).reverse + (h['time'] || '').split(?:))) if h['date'] end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
30 31 32 |
# File 'lib/nerdz/structs.rb', line 30 def from @from end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
30 31 32 |
# File 'lib/nerdz/structs.rb', line 30 def @message end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
30 31 32 |
# File 'lib/nerdz/structs.rb', line 30 def pid @pid end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
30 31 32 |
# File 'lib/nerdz/structs.rb', line 30 def time @time end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
30 31 32 |
# File 'lib/nerdz/structs.rb', line 30 def to @to end |