Sha256: 96b809c18f33e307ed3da4644462d00c1e905bee587408ff0f274951e6ee5bc5

Contents?: true

Size: 452 Bytes

Versions: 2

Compression:

Stored size: 452 Bytes

Contents

$:.push 'lib'; require 'transcriber'

class Root < Transcriber::Resource
  property :id
  embeds_one :item, if: proc {id == "1"}
end

class Item < Transcriber::Resource
  property :id
end

root = Root.parse({"id"=> 1, "item" => {"id" => 2000}}).first

puts "root:     #{root.inspect}"
puts "resource: #{root.resource}"


root = Root.parse({"id"=> 100, "item" => {"id" => 2000}}).first

puts "root:     #{root.inspect}"
puts "resource: #{root.resource}"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
transcriber-0.0.3 examples/embeds_one/with_if.rb
transcriber-0.0.2 examples/embeds_one/with_if.rb