Class: PolyrexSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/polyrex-schema.rb

Instance Method Summary collapse

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_aObject



18
# File 'lib/polyrex-schema.rb', line 18

def to_a()    scan_to_a(@doc.root.xpath 'records/.')  end

#to_docObject



20
# File 'lib/polyrex-schema.rb', line 20

def to_doc()  @doc                                    end

#to_hObject



19
# File 'lib/polyrex-schema.rb', line 19

def to_h()    scan_to_h(@doc.root.xpath 'records/.')  end

#to_sObject



21
# File 'lib/polyrex-schema.rb', line 21

def to_s()    @doc.to_s                               end