- Doc: http://sixarm.com/sixarm_ruby_rexml_element_new_with_options/doc
- Gem: http://rubygems.org/gems/sixarm_ruby_rexml_element_new_with_options
- Repo: http://github.com/sixarm/sixarm_ruby_rexml_element_new_with_options
This adds convenience methods to REXML::Element so we can create an Element easily.
Example:
e = Element.new_with_options(:name => "foo", :text => "bar")
#=> element with name "foo" and text "bar"
There are options for creating an Element with children, attributes, text, and additional methods that can create a table data cell and table row.
For docs go to http://sixarm.com/sixarm_ruby_rexml_element_new_with_options/doc
Want to help? We're happy to get pull requests.
To install this gem in your shell or terminal:
gem install sixarm_ruby_rexml_element_new_with_options
To add this gem to your Gemfile:
gem 'sixarm_ruby_rexml_element_new_with_options'
To require the gem in your code:
require 'sixarm_ruby_rexml_element_new_with_options'
child_1 = REXML::Element.new(...)
child_2 = REXML::Element.new(...)
child_3 = REXML::Element.new(...)
e = Element.new_with_options(:children => [child_1, child_2, child_3])
#=> element that has child elements
e = Element.new_with_options_as_td(:text => "bar")
#=> element with name "td" and text "bar"
e = Element.new_with_options_as_tr(:text => "bar")
#=> element with name "tr" and text "bar"
e = Element.new_with_options_as_tr(:cells => ["a", "b", "c"])
#=> element with name=="tr" and children elements with name "td" and text "a", "b", "c"