https://github.com/sixarm/sixarm_ruby_rexml_element_new_with_options
SixArm.com » Ruby » REXML::Element.new_with_options methods to build elements
https://github.com/sixarm/sixarm_ruby_rexml_element_new_with_options
element extensions gem rexml ruby
Last synced: 2 months ago
JSON representation
SixArm.com » Ruby » REXML::Element.new_with_options methods to build elements
- Host: GitHub
- URL: https://github.com/sixarm/sixarm_ruby_rexml_element_new_with_options
- Owner: SixArm
- License: other
- Created: 2012-03-20T20:50:51.000Z (over 14 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T09:20:59.000Z (about 1 year ago)
- Last Synced: 2026-03-31T01:54:34.400Z (3 months ago)
- Topics: element, extensions, gem, rexml, ruby
- Language: Ruby
- Homepage: http://sixarm.com
- Size: 257 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# SixArm.com → Ruby →
REXML::Element.new_with_options methods to build elements
* Doc:
* Gem:
* Repo:
## Introduction
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
Want to help? We're happy to get pull requests.
## Install
### Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_rexml_element_new_with_options
### Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_rexml_element_new_with_options'
### Require
To require the gem in your code:
require 'sixarm_ruby_rexml_element_new_with_options'
## Example of children
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
## Example of table methods
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"