Class: Blather::Stanza::X::Field::Option
- Defined in:
- lib/blather/stanza/x.rb
Overview
Option stanza fragment
Constant Summary
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(value, label = nil) ⇒ Object
Create a new X Field Option.
Instance Method Summary collapse
-
#label ⇒ String
The Field Option’s label.
-
#label=(label) ⇒ Object
Set the Field Option’s label.
-
#value ⇒ String
The Field Option’s value.
-
#value=(value) ⇒ Object
Set the Field Option’s value.
Methods inherited from XMPPNode
class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza
Class Method Details
.new(node) ⇒ Object .new(opts = {}) ⇒ Object .new(value, label = nil) ⇒ Object
Create a new X Field Option
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/blather/stanza/x.rb', line 363 def self.new(value, label = nil) new_node = super :option case value when Nokogiri::XML::Node new_node.inherit value when Hash new_node.value = value[:value] new_node.label = value[:label] else new_node.value = value new_node.label = label end new_node end |
Instance Method Details
#label ⇒ String
The Field Option’s label
402 403 404 |
# File 'lib/blather/stanza/x.rb', line 402 def label read_attr :label end |
#label=(label) ⇒ Object
Set the Field Option’s label
408 409 410 |
# File 'lib/blather/stanza/x.rb', line 408 def label=(label) write_attr :label, label end |
#value ⇒ String
The Field Option’s value
381 382 383 384 385 386 387 |
# File 'lib/blather/stanza/x.rb', line 381 def value if self.namespace content_from 'ns:value', :ns => self.namespace.href else content_from :value end end |