Method: REXML::Element#instructions
- Defined in:
- lib/rexml/element.rb
#instructions ⇒ Object
:call-seq:
instructions -> array_of_instruction_children
Returns a frozen array of the REXML::Instruction children of the element:
xml_string = <<-EOT
<root>
<?target0 foo?>
<?target1 bar?>
</root>
EOT
d = REXML::Document.new(xml_string)
is = d.root.instructions
is.frozen? # => true
is.map {|i| i.class } # => [REXML::Instruction, REXML::Instruction]
is.map {|i| i.to_s } # => ["<?target0 foo?>", "<?target1 bar?>"]
1453 1454 1455 |
# File 'lib/rexml/element.rb', line 1453 def instructions find_all { |child| child.kind_of? Instruction }.freeze end |