Class: Blather::Stanza::Message::Delay

Inherits:
XMPPNode
  • Object
show all
Defined in:
lib/blather/stanza/message.rb

Constant Summary

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XMPPNode

class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza

Class Method Details

.new(stamp = nil, from = nil, description = nil) ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/blather/stanza/message.rb', line 394

def self.new(stamp = nil, from = nil, description = nil)
  new_node = super :delay

  case stamp
  when Nokogiri::XML::Node
    new_node.inherit stamp
  when Hash
    new_node.stamp = stamp[:stamp]
    new_node.from = stamp[:from]
    new_node.description = stamp[:description]
  else
    new_node.stamp = stamp
    new_node.from = from
    new_node.description = description
  end
  new_node
end

Instance Method Details

#descriptionObject



421
422
423
# File 'lib/blather/stanza/message.rb', line 421

def description
  content.strip
end

#fromObject



412
413
414
# File 'lib/blather/stanza/message.rb', line 412

def from
  read_attr :from
end

#stampObject



416
417
418
419
# File 'lib/blather/stanza/message.rb', line 416

def stamp
  s = read_attr :stamp
  s && Time.parse(s)
end