Class: PolyrexObjectMethods

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

Overview

file: polyrex-object-methods.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ PolyrexObjectMethods

Returns a new instance of PolyrexObjectMethods.



7
8
9
10
11
12
13
14
15
16
# File 'lib/polyrex-object-methods.rb', line 7

def initialize(schema)
  
  a = schema.split('/')
  a.shift

  @a = a.map do |x|
    name, raw_fields = x.split('[')
    [name.capitalize, raw_fields ? raw_fields.chop.split(',').map(&:strip) : []]
  end
end

Instance Method Details

#to_aObject



18
19
20
# File 'lib/polyrex-object-methods.rb', line 18

def to_a
  @a
end