Method: PYR::Parser.parse

Defined in:
lib/pyr/parser.rb

.parse(body, controller) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/pyr/parser.rb', line 6

def self.parse(body, controller)
  if body.keys.first == 'self'
    klass = "PYR::#{controller.to_s.classify}".constantize
    LazyRecord::Relation.new model: klass, array: [klass.new(body)]
  else
    reduce_body(body)
  end
end