ryo.rb 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -10
- data/lib/ryo/basic_object.rb +7 -11
- data/lib/ryo/builder.rb +35 -54
- data/lib/ryo/enumerable.rb +62 -79
- data/lib/ryo/object.rb +6 -10
- data/lib/ryo/reflect.rb +57 -157
- data/lib/ryo/utils.rb +68 -0
- data/lib/ryo/version.rb +1 -1
- data/lib/ryo.rb +24 -37
- data/share/ryo.rb/examples/1.0_prototypes_point_object.rb +1 -0
- data/share/ryo.rb/examples/1.1_prototypes_ryo_fn.rb +1 -0
- data/share/ryo.rb/examples/2.0_iteration_each.rb +1 -0
- data/share/ryo.rb/examples/2.1_iteration_map.rb +1 -0
- data/share/ryo.rb/examples/2.2_iteration_ancestors.rb +1 -0
- data/share/ryo.rb/examples/3.0_recursion_ryo_from.rb +1 -0
- data/share/ryo.rb/examples/3.1_recursion_ryo_from_with_array.rb +1 -0
- data/share/ryo.rb/examples/3.2_recursion_ryo_from_with_openstruct.rb +1 -0
- data/share/ryo.rb/examples/4.0_basicobject_ryo_basicobject.rb +1 -0
- data/share/ryo.rb/examples/4.1_basicobject_ryo_basicobject_from.rb +1 -0
- data/share/ryo.rb/examples/5_collisions_resolution_strategy.rb +1 -0
- data/share/ryo.rb/examples/6_beyond_hash_objects.rb +1 -0
- data/share/ryo.rb/examples/7_ryo_memo.rb +1 -0
- data/spec/ryo_enumerable_spec.rb +1 -1
- data/spec/ryo_reflect_spec.rb +8 -0
- data/spec/ryo_spec.rb +1 -1
- metadata +4 -3
data/spec/ryo_reflect_spec.rb
CHANGED
@@ -170,6 +170,14 @@ RSpec.describe Ryo::Reflect do
|
|
170
170
|
it { expect(table["point"]["point"]).to be_instance_of(Hash) }
|
171
171
|
it { is_expected.to eq("point" => {"point" => {"x" => 1, "y" => 1}}) }
|
172
172
|
end
|
173
|
+
|
174
|
+
context "when a Ryo object references an Array" do
|
175
|
+
let(:ryo) { Ryo(points: [Ryo(x: 1, y: 1)]) }
|
176
|
+
it { expect(table).to be_instance_of(Hash) }
|
177
|
+
it { expect(table["points"]).to be_instance_of(Array) }
|
178
|
+
it { expect(table["points"][0]).to be_instance_of(Hash) }
|
179
|
+
it { is_expected.to eq("points" => [{"x" => 1, "y" => 1}]) }
|
180
|
+
end
|
173
181
|
end
|
174
182
|
end
|
175
183
|
end
|
data/spec/ryo_spec.rb
CHANGED
@@ -113,7 +113,7 @@ RSpec.describe Ryo do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
context "when verifying the source and duplicate are distinct objects" do
|
116
|
-
subject {
|
116
|
+
subject { Module.instance_method(:equal?).bind_call(point_c, dup) }
|
117
117
|
it { is_expected.to eq(false) }
|
118
118
|
end
|
119
119
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryo.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/ryo/memo.rb
|
122
122
|
- lib/ryo/object.rb
|
123
123
|
- lib/ryo/reflect.rb
|
124
|
+
- lib/ryo/utils.rb
|
124
125
|
- lib/ryo/version.rb
|
125
126
|
- lib/ryo/yaml.rb
|
126
127
|
- ryo.rb.gemspec
|
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
rubygems_version: 3.5.
|
172
|
+
rubygems_version: 3.5.13
|
172
173
|
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: Ryo implements prototype-based inheritance, in Ruby
|