Sha256: ccd2a00e2312b7f8ef87fd1ff84d1aad32c99b62337ab5ec9f19d6ce1d797872

Contents?: true

Size: 407 Bytes

Versions: 2

Compression:

Stored size: 407 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative "setup"
require "ryo"

point_x = Ryo(x: 5)
point_y = Ryo({y: 10}, point_x)
point = Ryo({}, point_y)

p Ryo.find(point, ancestors: 0) { |k,v| v == 5 }   # => nil
p Ryo.find(point, ancestors: 1) { |k,v| v == 5 }   # => nil
p Ryo.find(point, ancestors: 2) { |k,v| v == 5 }.x # => point_x.x
p Ryo.find(point) { |k,v| v == 5 }.x # => point_x.x

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ryo.rb-0.5.7 share/examples/ryo.rb/2.2_iteration_ancestors.rb
ryo.rb-0.5.6 share/ryo.rb/examples/2.2_iteration_ancestors.rb