Class: PolyrexBuilder
- Inherits:
-
Object
- Object
- PolyrexBuilder
- Defined in:
- lib/polyrex-builder.rb
Instance Method Summary collapse
-
#initialize(rows = [], parents: [], summary: {}, rootname: 'items') ⇒ PolyrexBuilder
constructor
A new instance of PolyrexBuilder.
- #to_a ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(rows = [], parents: [], summary: {}, rootname: 'items') ⇒ PolyrexBuilder
Returns a new instance of PolyrexBuilder.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/polyrex-builder.rb', line 12 def initialize(rows=[], parents: [], summary: {}, rootname: 'items') records = rows.map {|x| pxify(x, parents) } summary.merge!({recordx_type: 'polyrex'}) h = {rootname.to_sym => {summary: summary, records: records }} @a = RexleBuilder.new(h).to_a[3] end |
Instance Method Details
#to_a ⇒ Object
23 24 25 |
# File 'lib/polyrex-builder.rb', line 23 def to_a() @a end |
#to_xml ⇒ Object
27 28 29 |
# File 'lib/polyrex-builder.rb', line 27 def to_xml() Rexle.new(@a).xml pretty: true end |