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
17
# File 'lib/polyrex-schema.rb', line 9

def initialize(s)

  s.prepend 'root/' if s[0] == '{'
  a = s.split('/')

  r = add_node a
  r[3] << node('recordx_type', 'polyrex') << node('schema',s)
  @doc = Rexle.new(r)
end

Instance Method Details

#to_aObject



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

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

#to_docObject



23
24
25
# File 'lib/polyrex-schema.rb', line 23

def to_doc()
  @doc
end

#to_sObject



27
28
29
# File 'lib/polyrex-schema.rb', line 27

def to_s()
  @doc.to_s
end