class Lurker::Json::Parser::PlainStrategy
Attributes
schema_options[R]
Public Class Methods
new(options)
click to toggle source
# File lib/lurker/json/parser/plain_strategy.rb, line 9 def initialize(options) @schema_options = options.dup end
Public Instance Methods
parse(payload)
click to toggle source
# File lib/lurker/json/parser/plain_strategy.rb, line 13 def parse(payload) case payload when Lurker::Json::Schema payload when Hash return parse_as_typed(payload) if type_defined?(payload) || type_supposed?(payload) Lurker::Json::Schema.new(payload, schema_options) when Array payload.map do |schema| Lurker::Json::Parser.plain(schema_options).parse(schema) end else payload end end
Private Instance Methods
parse_as_typed(payload)
click to toggle source
# File lib/lurker/json/parser/plain_strategy.rb, line 33 def parse_as_typed(payload) Lurker::Json::Parser.typed(schema_options).parse(payload) end