Class: PolyrexSchema
- Inherits:
-
Object
- Object
- PolyrexSchema
- Defined in:
- lib/polyrex-schema.rb
Instance Method Summary collapse
-
#initialize(s) ⇒ PolyrexSchema
constructor
A new instance of PolyrexSchema.
- #to_a ⇒ Object
- #to_doc ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(s) ⇒ PolyrexSchema
Returns a new instance of PolyrexSchema.
9 10 11 12 13 14 15 16 |
# File 'lib/polyrex-schema.rb', line 9 def initialize(s) s.prepend 'root/' if s[0] == '{' r = add_node split(s) r[3] << node('recordx_type', 'polyrex') << node('schema',s) @doc = Rexle.new(r) end |
Instance Method Details
#to_a ⇒ Object
18 |
# File 'lib/polyrex-schema.rb', line 18 def to_a() scan_to_a(@doc.root.xpath 'records/.') end |
#to_doc ⇒ Object
20 |
# File 'lib/polyrex-schema.rb', line 20 def to_doc() @doc end |
#to_h ⇒ Object
19 |
# File 'lib/polyrex-schema.rb', line 19 def to_h() scan_to_h(@doc.root.xpath 'records/.') end |
#to_s ⇒ Object
21 |
# File 'lib/polyrex-schema.rb', line 21 def to_s() @doc.to_s end |