Class: Blather::Stanza::X::Field::Option
- Inherits:
-
XMPPNode
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza::X::Field::Option
- Defined in:
- lib/blather/stanza/x.rb
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, #content_from, import, #inherit, #inherit_attrs, #inspect, #namespace=, #namespace_href, #nokogiri_namespace=, #read_attr, #read_content, register, #remove_child, #remove_children, #set_content_for, #to_stanza, #write_attr
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(node) ⇒ Object .new(opts = {}) ⇒ Object .new(value, label = nil) ⇒ Object
Create a new X Field Option
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/blather/stanza/x.rb', line 345 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
384 385 386 |
# File 'lib/blather/stanza/x.rb', line 384 def label read_attr :label end |
#label=(label) ⇒ Object
Set the Field Option’s label
390 391 392 |
# File 'lib/blather/stanza/x.rb', line 390 def label=(label) write_attr :label, label end |
#value ⇒ String
The Field Option’s value
363 364 365 366 367 368 369 |
# File 'lib/blather/stanza/x.rb', line 363 def value if self.namespace content_from 'ns:value', :ns => self.namespace.href else content_from :value end end |