Sha256: 7067433bcc231eb1848a5493a7d761e8883a1fa2be32cf5043ef5ce4785ff15a

Contents?: true

Size: 505 Bytes

Versions: 17

Compression:

Stored size: 505 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

17 entries across 17 versions & 1 rubygems

Version Path
transcriber-0.0.26 examples/embeds_one/with_if.rb
transcriber-0.0.25 examples/embeds_one/with_if.rb
transcriber-0.0.24 examples/embeds_one/with_if.rb
transcriber-0.0.23 examples/embeds_one/with_if.rb
transcriber-0.0.22 examples/embeds_one/with_if.rb
transcriber-0.0.21 examples/embeds_one/with_if.rb
transcriber-0.0.20 examples/embeds_one/with_if.rb
transcriber-0.0.19 examples/embeds_one/with_if.rb
transcriber-0.0.18 examples/embeds_one/with_if.rb
transcriber-0.0.17 examples/embeds_one/with_if.rb
transcriber-0.0.16 examples/embeds_one/with_if.rb
transcriber-0.0.15 examples/embeds_one/with_if.rb
transcriber-0.0.14 examples/embeds_one/with_if.rb
transcriber-0.0.13 examples/embeds_one/with_if.rb
transcriber-0.0.12 examples/embeds_one/with_if.rb
transcriber-0.0.11 examples/embeds_one/with_if.rb
transcriber-0.0.10 examples/embeds_one/with_if.rb