Sha256: 4b7f7aff4a9f77a74bacfade430768c3297c91670c566999d0c16c61c767c43c
Contents?: true
Size: 618 Bytes
Versions: 1
Compression:
Stored size: 618 Bytes
Contents
module Yaks module Reader class SimpleJson def call(parsed_json, env = {}) type = env[:type] || parsed_json.first.first attributes = env[:attributes] || parsed_json[type] if attributes.is_a? Array attributes = attributes.dup members = attributes.map { |r| call(r, type: type, attributes: r) } CollectionResource.new(members: members, type: Util.singularize(type)) else Resource.new( type: Util.singularize(type), attributes: Util.symbolize_keys(attributes) ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yaks-simple-0.0.1 | lib/yaks/reader/simple_json.rb |