Class: Ayril::XMLElement
- Includes:
- ElementAttributeManipulation, ElementClassnameManipulation, ElementManipulation, ElementStyleManipulation, Ayril::XMLNode::NodeManipulation, Ayril::XMLNode::NodeTraversal
- Defined in:
- lib/ayril/xml_element.rb,
lib/ayril/xml_element/xml_css_hash.rb,
lib/ayril/xml_element/xml_attribute_hash.rb,
lib/ayril/xml_element/element_manipulation.rb,
lib/ayril/xml_element/element_style_manipulation.rb,
lib/ayril/xml_element/element_attribute_manipulation.rb,
lib/ayril/xml_element/element_classname_manipulation.rb
Defined Under Namespace
Modules: ElementAttributeManipulation, ElementClassnameManipulation, ElementManipulation, ElementStyleManipulation Classes: XMLAttributeHash, XMLCSSHash
Constant Summary collapse
- @@id_counter =
0
Instance Attribute Summary collapse
-
#id_counter ⇒ Object
Returns the value of attribute id_counter.
Class Method Summary collapse
Instance Method Summary collapse
- #initWithName(name, URI: uri) ⇒ Object
- #initWithXMLString(string, error: error) ⇒ Object
- #inspect ⇒ Object
- #kind ⇒ Object
Methods included from ElementStyleManipulation
#get_style, #set_style, #style, #style=
Methods included from ElementClassnameManipulation
#add_class_name, #has_class_name?, #remove_class_name, #toggle_class_name
Methods included from ElementAttributeManipulation
#attribute, #attribute=, #has_attribute?, #read_attribute, #remove_attribute, #write_attribute
Methods included from ElementManipulation
#append, #identify, #insert, #prepend, #wrap
Methods included from Ayril::XMLNode::NodeTraversal
#adjacent, #ancestors, #at, #contains?, #descendant_of?, #descendants, #down, #empty?, #first_descendant, #immediate_descendants, #next, #next_element_sibling, #next_siblings, #previous, #previous_element_sibling, #previous_siblings, #recursively_collect, #select, #select_by_xpath, #siblings, #up
Methods included from Ayril::XMLNode::NodeManipulation
#clean_whitespace, #inner_html, #remove, #replace, #update
Instance Attribute Details
#id_counter ⇒ Object
Returns the value of attribute id_counter.
41 42 43 |
# File 'lib/ayril/xml_element.rb', line 41 def id_counter @id_counter end |
Class Method Details
.new(name, attributes = {}) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/ayril/xml_element.rb', line 43 def self.new(name, attributes={}) if attributes.empty? and name.include? "<" self.alloc.initWithXMLString name, error: nil else XMLNode.elementWithName name, children: nil, attributes: attributes end end |
Instance Method Details
#initWithName(name, URI: uri) ⇒ Object
53 54 55 |
# File 'lib/ayril/xml_element.rb', line 53 def initWithName(name) self.class.alloc.tap { |e| e.name = name } end |
#initWithXMLString(string, error: error) ⇒ Object
65 66 67 68 |
# File 'lib/ayril/xml_element.rb', line 65 def initWithXMLString(string, error: error) d = XMLDocument.alloc.initWithXMLString(string, options: 0, error: nil) d.maybe(:rootElement).tap { |n| n.maybe :detach } end |
#inspect ⇒ Object
70 71 72 73 |
# File 'lib/ayril/xml_element.rb', line 70 def inspect attributes = self.attribute.tap { |a| a.sync } "#<#{self.class}<#{self.name}#{attributes.maybe(:empty?) ? '' : ' '}#{attributes}>>" end |
#kind ⇒ Object
51 |
# File 'lib/ayril/xml_element.rb', line 51 def kind; NSXMLElementKind end |