Sha256: 3b9ff09227873957c583550c6efa4ab70efa6699487e364be50913e668c39043

Contents?: true

Size: 543 Bytes

Versions: 6

Compression:

Stored size: 543 Bytes

Contents

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

class Item < Transcriber::Resource
  property :id
end

class Root < Transcriber::Resource
  property :id
  embeds_many :items, if: proc {id == "10"}
end

@root_with_items = Root.parse({"id" => 10, "items" => [{"id" => 2000}]}).first

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


@root_without_items = Root.parse({"id" => 1, "items" => [{"id" => 2000}]}).first

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

Version data entries

6 entries across 6 versions & 1 rubygems

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