Class: Nerdz::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/nerdz/structs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject (readonly)

Returns the value of attribute from.



30
31
32
# File 'lib/nerdz/structs.rb', line 30

def from
  @from
end

#messageObject (readonly)

Returns the value of attribute message.



30
31
32
# File 'lib/nerdz/structs.rb', line 30

def message
  @message
end

#pidObject (readonly)

Returns the value of attribute pid.



30
31
32
# File 'lib/nerdz/structs.rb', line 30

def pid
  @pid
end

#timeObject (readonly)

Returns the value of attribute time.



30
31
32
# File 'lib/nerdz/structs.rb', line 30

def time
  @time
end

#toObject (readonly)

Returns the value of attribute to.



30
31
32
# File 'lib/nerdz/structs.rb', line 30

def to
  @to
end