Class: LibXMLJRuby::XML::Node::Set
- Inherits:
-
Object
- Object
- LibXMLJRuby::XML::Node::Set
- Includes:
- Enumerable
- Defined in:
- lib/libxml-jruby/xml/node.rb
Instance Attribute Summary collapse
-
#java_obj ⇒ Object
Returns the value of attribute java_obj.
Class Method Summary collapse
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize ⇒ Set
constructor
A new instance of Set.
- #length ⇒ Object
Constructor Details
#initialize ⇒ Set
Returns a new instance of Set.
254 255 256 257 |
# File 'lib/libxml-jruby/xml/node.rb', line 254 def initialize @java_obj = java_obj @node_cache = {} end |
Instance Attribute Details
#java_obj ⇒ Object
Returns the value of attribute java_obj.
252 253 254 |
# File 'lib/libxml-jruby/xml/node.rb', line 252 def java_obj @java_obj end |
Class Method Details
.from_java(java_obj) ⇒ Object
243 244 245 246 247 |
# File 'lib/libxml-jruby/xml/node.rb', line 243 def from_java(java_obj) s = new s.java_obj = java_obj s end |
Instance Method Details
#[](index) ⇒ Object
267 268 269 |
# File 'lib/libxml-jruby/xml/node.rb', line 267 def [](index) @node_cache[index] ||= LibXMLJRuby::XML::Node.from_java(java_obj.item(index)) end |
#each ⇒ Object
275 276 277 278 279 280 281 |
# File 'lib/libxml-jruby/xml/node.rb', line 275 def each i = 0 while(i < java_obj.length) yield self[i] i += 1 end end |
#empty? ⇒ Boolean
263 264 265 |
# File 'lib/libxml-jruby/xml/node.rb', line 263 def empty? java_obj.length < 1 end |
#first ⇒ Object
271 272 273 |
# File 'lib/libxml-jruby/xml/node.rb', line 271 def first self[0] end |
#length ⇒ Object
259 260 261 |
# File 'lib/libxml-jruby/xml/node.rb', line 259 def length java_obj.length end |