Sha256: 4be9deba9ab6eff2bc78472b043d47e0d8ed90b932af3a68b426534c70a97c7f

Contents?: true

Size: 527 Bytes

Versions: 6

Compression:

Stored size: 527 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_with_item = Root.parse({"id"=> 1, "item" => {"id" => 2000}}).first

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


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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
transcriber-0.0.9 examples/embeds_one/with_if.rb
transcriber-0.0.8 examples/embeds_one/with_if.rb
transcriber-0.0.7 examples/embeds_one/with_if.rb
transcriber-0.0.6 examples/embeds_one/with_if.rb
transcriber-0.0.5 examples/embeds_one/with_if.rb
transcriber-0.0.4 examples/embeds_one/with_if.rb