ryo.rb 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/specs.yml +2 -2
  3. data/.rubocop.yml +2 -0
  4. data/README.md +28 -26
  5. data/lib/ryo/json.rb +6 -11
  6. data/lib/ryo/keywords.rb +16 -28
  7. data/lib/ryo/reflect.rb +0 -16
  8. data/lib/ryo/version.rb +1 -1
  9. data/lib/ryo/yaml.rb +6 -11
  10. data/lib/ryo.rb +5 -3
  11. data/ryo.rb.gemspec +1 -0
  12. data/share/examples/ryo.rb/3.0_recursion_ryo_from.rb +20 -0
  13. data/share/{ryo.rb/examples → examples/ryo.rb}/3.1_recursion_ryo_from_with_array.rb +4 -4
  14. data/share/{ryo.rb/examples → examples/ryo.rb}/3.2_recursion_ryo_from_with_openstruct.rb +2 -3
  15. data/share/ryo.rb/NEWS +11 -0
  16. data/spec/readme_spec.rb +2 -2
  17. data/spec/ryo_json_spec.rb +1 -1
  18. data/spec/ryo_keywords_spec.rb +1 -1
  19. data/spec/ryo_prototypes_spec.rb +1 -1
  20. data/spec/ryo_yaml_spec.rb +1 -1
  21. metadata +33 -18
  22. data/share/ryo.rb/examples/3.0_recursion_ryo_from.rb +0 -14
  23. /data/share/{ryo.rb/examples → examples/ryo.rb}/1.0_prototypes_point_object.rb +0 -0
  24. /data/share/{ryo.rb/examples → examples/ryo.rb}/1.1_prototypes_ryo_fn.rb +0 -0
  25. /data/share/{ryo.rb/examples → examples/ryo.rb}/2.0_iteration_each.rb +0 -0
  26. /data/share/{ryo.rb/examples → examples/ryo.rb}/2.1_iteration_map.rb +0 -0
  27. /data/share/{ryo.rb/examples → examples/ryo.rb}/2.2_iteration_ancestors.rb +0 -0
  28. /data/share/{ryo.rb/examples → examples/ryo.rb}/4.0_basicobject_ryo_basicobject.rb +0 -0
  29. /data/share/{ryo.rb/examples → examples/ryo.rb}/4.1_basicobject_ryo_basicobject_from.rb +0 -0
  30. /data/share/{ryo.rb/examples → examples/ryo.rb}/5_collisions_resolution_strategy.rb +0 -0
  31. /data/share/{ryo.rb/examples → examples/ryo.rb}/6_beyond_hash_objects.rb +0 -0
  32. /data/share/{ryo.rb/examples → examples/ryo.rb}/7_ryo_memo.rb +0 -0
  33. /data/share/{ryo.rb/examples → examples/ryo.rb}/setup.rb +0 -0
  34. /data/{LICENSE → share/ryo.rb/LICENSE} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae979c4fc47c5c25d26b0c215807a7ebd867dc5abd596277dda692c36c5c3445
4
- data.tar.gz: 3cf89103180d9d6280698b93520eb80dc9af2e3ff4cbebb84c54b1089bed12e6
3
+ metadata.gz: fbd00dab052b65ba426cdaa4ac900adc2daca2e23d1cbe5919a19e31bce30e45
4
+ data.tar.gz: 6757fd8be13568acb58fa6e0e5ec3ff395ab56bb14354dd6bbd024665998ff1d
5
5
  SHA512:
6
- metadata.gz: 795a2ab471038483d47fa39103996ec756da3437098b27091bb3b6e1f6534202ebc508e33f8d38bda4dfee8ae835465947da0c8adb2c13805480f13b4f54f4fe
7
- data.tar.gz: edd4fd919629134e9479a91469084dbbdaf5507ce6aef91b7e1779720bff76ad1aec675dd31de42a05c7a8375d4c0ca27ce5aba260059b18fa526ec755bc7a0a
6
+ metadata.gz: 13896d019d82fdb27003ead6dd60a34a8f2c09efb2aa018b74f520d8dbc5c79e775d5637ba66e715089221aad160dc7a00477cd0a908777ed9e5098c8eccf552
7
+ data.tar.gz: 3bfc72a7632226f9b67899045869fbec25a505276d5d595c5f13dc7a288924a4510d1b5e7ec69c120bff981fae887684953e6a223e481920dbf77d880c3448d1
@@ -19,5 +19,5 @@ jobs:
19
19
  - uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: ${{ matrix.ruby }}
22
- - run: bundle install
23
- - run: rake ci
22
+ - run: ruby -S bundle install
23
+ - run: ruby -S bundle exec rake ci
data/.rubocop.yml CHANGED
@@ -22,6 +22,8 @@ Style/LambdaCall:
22
22
  Enabled: false
23
23
  Lint/AssignmentInCondition:
24
24
  Enabled: false
25
+ Style/ArgumentsForwarding:
26
+ Enabled: false
25
27
 
26
28
  ##
27
29
  # Disabled cops (rspec)
data/README.md CHANGED
@@ -173,9 +173,7 @@ p Ryo.find(point) { |k,v| v == 5 }.x # => point_x.x
173
173
  The [`Ryo.from`](https://0x1eef.github.io/x/ryo.rb/Ryo.html#from-class_method) method has
174
174
  the same interface as the [`Ryo`](https://0x1eef.github.io/x/ryo.rb/top-level-namespace.html#Ryo-instance_method)
175
175
  method, but it is implemented to recursively walk a Hash object and create Ryo objects
176
- from other Hash objects found along the way. Recursion is not the default behavior
177
- because it has the potential to be slow when given a complex Hash object that's
178
- very large - otherwise there shouldn't be a noticeable performance impact.
176
+ from other Hash objects found along the way.
179
177
 
180
178
  The following example demonstrates [`Ryo.from`](https://0x1eef.github.io/x/ryo.rb/Ryo.html#from-class_method):
181
179
 
@@ -183,14 +181,20 @@ The following example demonstrates [`Ryo.from`](https://0x1eef.github.io/x/ryo.r
183
181
  #!/usr/bin/env ruby
184
182
  require "ryo"
185
183
 
186
- point = Ryo.from({
187
- x: {to_i: 0},
188
- y: {to_i: 10}
184
+ person = Ryo.from({
185
+ name: "John",
186
+ age: 30,
187
+ address: {
188
+ street: "123 Main St",
189
+ city: "Anytown",
190
+ state: "AS",
191
+ zip: 12345
192
+ }
189
193
  })
190
- p [point.x.to_i, point.y.to_i]
194
+ p [person.name, person.age, person.address.city]
191
195
 
192
196
  ##
193
- # [0, 10]
197
+ # ["John", 30, "Anytown"]
194
198
  ```
195
199
 
196
200
  #### Ryo.from with an Array
@@ -205,14 +209,14 @@ example demonstrates how that works in practice:
205
209
  require "ryo"
206
210
 
207
211
  points = Ryo.from([
208
- {x: {to_i: 2}},
212
+ {x: 2},
209
213
  "foobar",
210
- {y: {to_i: 4}}
214
+ {y: 4}
211
215
  ])
212
216
 
213
- p points[0].x.to_i
217
+ p points[0].x
214
218
  p points[1]
215
- p points[2].y.to_i
219
+ p points[2].y
216
220
 
217
221
  ##
218
222
  # 2
@@ -225,8 +229,7 @@ p points[2].y.to_i
225
229
  All methods that can create Ryo objects support turning a Struct, or OpenStruct object
226
230
  into a Ryo object. The following example demonstrates how
227
231
  [`Ryo.from`](https://0x1eef.github.io/x/ryo.rb/Ryo.html#from-class_method)
228
- can recursively turn an OpenStruct object into Ryo objects. The example also assigns
229
- a prototype to the Ryo object created from the OpenStruct:
232
+ can recursively turn an OpenStruct object into Ryo objects:
230
233
 
231
234
  ``` ruby
232
235
  #!/usr/bin/env ruby
@@ -234,10 +237,9 @@ require "ryo"
234
237
  require "ostruct"
235
238
 
236
239
  point = Ryo.from(
237
- OpenStruct.new(x: {to_i: 5}),
238
- Ryo.from(y: {to_i: 10})
240
+ OpenStruct.new(x: 5, y: 10)
239
241
  )
240
- p [point.x.to_i, point.y.to_i]
242
+ p [point.x, point.y]
241
243
 
242
244
  ##
243
245
  # [5, 10]
@@ -293,11 +295,11 @@ p [point.x.to_i, point.y.to_i]
293
295
  #### Resolution strategy
294
296
 
295
297
  When a property and method collide, Ryo tries to
296
- find the best resolution. Since Ryo properties don't
297
- accept arguments, and methods can - we are able to
298
- distinguish a method from a Ryo property by the presence
299
- or absence of an argument. Consider the following example,
300
- where a property collides with the `Kernel#then` method:
298
+ find the best resolution. Because Ryo properties don't
299
+ accept arguments, and methods can - we can distinguish a
300
+ method from a Ryo property by the presence or absence of
301
+ an argument in at least some cases. Consider the following
302
+ example, where a property collides with the `Kernel#then` method:
301
303
 
302
304
  ```ruby
303
305
  #!/usr/bin/env ruby
@@ -316,10 +318,10 @@ p ryo.then { 34 } # => 34
316
318
 
317
319
  The documentation has used simple terms to describe
318
320
  the objects that Ryo works with: Hash and Array objects.
319
- But that doesn't quite capture the fact that Ryo
320
- uses duck typing: any object that implements `#each_pair`
321
- is similar to a Hash, and any object that implements
322
- `#each` is similar to an Array. Note that only
321
+ But that doesn't quite capture that Ryo is implemented with
322
+ duck typing: any object that implements `#each_pair`
323
+ could be used instead of a Hash, and any object that
324
+ implements `#each` could be used instead of an Array. Note that only
323
325
  [Ryo.from](https://0x1eef.github.io/x/ryo.rb/Ryo.html#from-class_method),
324
326
  [Ryo::Object.from](https://0x1eef.github.io/x/ryo.rb/Ryo/Object.html#from-class_method)
325
327
  and
data/lib/ryo/json.rb CHANGED
@@ -1,45 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  ##
4
- # The {Ryo::JSON Ryo::JSON} module provides a number of methods
5
- # for coercing JSON data into a Ryo object. It must be required
6
- # separately to Ryo (ie: require "ryo/json"), and the methods of
7
- # this module are then available on the {Ryo Ryo} module.
4
+ # The {Ryo::JSON Ryo::JSON} module provides a number of options
5
+ # for coercing JSON data into a Ryo object. The methods of
6
+ # this module are available on the {Ryo Ryo} module as singleton
7
+ # methods
8
8
  module Ryo::JSON
9
- require "json"
10
9
  extend self
11
10
 
12
11
  ##
13
12
  # @example
14
13
  # Ryo.from_json(path: "/foo/bar/baz.json")
15
14
  # Ryo.from_json(string: "[]")
16
- #
17
15
  # @param [String] path
18
16
  # The path to a JSON file
19
- #
20
17
  # @param [String] string
21
18
  # A blob of JSON
22
- #
23
19
  # @param [Ryo] object
24
20
  # {Ryo::Object Ryo::Object}, or {Ryo::BasicObject Ryo::BasicObject}
25
21
  # Defaults to {Ryo::Object Ryo::Object}
26
- #
27
22
  # @raise [SystemCallError]
28
23
  # Might raise a number of Errno exceptions
29
- #
30
24
  # @return [Ryo::Object, Ryo::BasicObject]
31
25
  # Returns a Ryo object
32
26
  def from_json(path: nil, string: nil, object: Ryo::Object)
33
27
  if path && string
34
28
  raise ArgumentError, "Provide a path or string but not both"
35
29
  elsif path
30
+ require "json" unless defined?(JSON)
36
31
  object.from JSON.parse(File.binread(path))
37
32
  elsif string
33
+ require "json" unless defined?(JSON)
38
34
  object.from JSON.parse(string)
39
35
  else
40
36
  raise ArgumentError, "No path or string provided"
41
37
  end
42
38
  end
43
-
44
39
  Ryo.extend(self)
45
40
  end
data/lib/ryo/keywords.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  ##
4
4
  # The {Ryo::Keywords Ryo::Keywords} module implements Ryo equivalents
5
- # to some of JavaScript's keywords - for example: the **in** and **delete**
6
- # operators. The instance methods of this module are available as singleton
5
+ # for some of JavaScript's keywords (eg: the **in** and **delete** operators).
6
+ # The instance methods of this module are available as singleton
7
7
  # methods on the {Ryo} module.
8
8
  module Ryo::Keywords
9
9
  ##
@@ -24,44 +24,32 @@ module Ryo::Keywords
24
24
  alias_method :function, :fn
25
25
 
26
26
  ##
27
- # Equivalent to JavaScript's **in** operator.
28
- #
27
+ # Equivalent to JavaScript's **in** operator
29
28
  # @param [<Ryo::Object, Ryo::BasicObject>] ryo
30
- # A Ryo object.
31
- #
29
+ # A Ryo object
32
30
  # @param [<String, #to_s>] property
33
- # A property name.
34
- #
31
+ # A property name
35
32
  # @return [Boolean]
36
- # Returns true when **property** is a member of **ryo**, or its prototype chain.
33
+ # Returns true when **property** is a member of **ryo**, or its prototype chain
37
34
  def in?(ryo, property)
38
35
  return false unless ryo
39
36
  property?(ryo, property) || in?(prototype_of(ryo), property)
40
37
  end
41
38
 
42
39
  ##
43
- # The {#delete} method deletes a property from a Ryo object.
44
- # More or less equivalent to JavaScript's "delete" operator.
45
- #
46
- # @note
47
- # This method does not delete properties from the prototype(s)
48
- # of a Ryo object. <br>
49
- # For that - see {Ryo::Reflect#delete! Ryo::Reflect#delete!}.
50
- #
40
+ # The {#delete} method deletes a property from a Ryo object
41
+ # @see Ryo::Reflect#delete!
51
42
  # @param [<Ryo::Object, Ryo::BasicObject>] ryo
52
- # A Ryo object.
53
- #
43
+ # A Ryo object
54
44
  # @param [<String, #to_s>] property
55
- # A property name.
56
- #
45
+ # A property name
46
+ # @param [Integer] ancestors
47
+ # The number of prototypes to traverse.
48
+ # Defaults to the entire prototype chain.
57
49
  # @return [void]
58
- def delete(ryo, property)
59
- property = property.to_s
60
- if property?(ryo, property)
61
- table_of(ryo).delete(property)
62
- else
63
- return if getter_defined?(ryo, property)
64
- define_method!(ryo, property) { ryo[property] }
50
+ def delete(ryo, property, ancestors: nil)
51
+ each_ryo(ryo, ancestors:) do
52
+ Ryo.property?(_1, property) ? table_of(_1).delete(property) : nil
65
53
  end
66
54
  end
67
55
  end
data/lib/ryo/reflect.rb CHANGED
@@ -125,22 +125,6 @@ module Ryo::Reflect
125
125
  ##
126
126
  # @group Ryo-specific
127
127
 
128
- ##
129
- # The {#delete!} method deletes a property from a Ryo object,
130
- # and from the prototypes in its prototype chain
131
- #
132
- # @see Ryo::Keywords#delete
133
- # @param [<Ryo::Object, Ryo::BasicObject>] ryo
134
- # A Ryo object
135
- # @param [<String, #to_s>] property
136
- # The name of a property
137
- # @return [void]
138
- def delete!(ryo, property)
139
- [ryo, *prototype_chain_of(ryo)].each do
140
- Ryo.delete(_1, property.to_s)
141
- end
142
- end
143
-
144
128
  ##
145
129
  # @param [<Ryo::Object, Ryo::BasicObject>] ryo
146
130
  # A Ryo object
data/lib/ryo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ryo
4
- VERSION = "0.5.6"
4
+ VERSION = "0.5.7"
5
5
  end
data/lib/ryo/yaml.rb CHANGED
@@ -1,45 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  ##
4
- # The {Ryo::YAML Ryo::YAML} module provides a number of methods
5
- # for coercing YAML data into a Ryo object. It must be required
6
- # separately to Ryo (ie: require "ryo/yaml"), and the methods of
7
- # this module are then available on the {Ryo Ryo} module.
4
+ # The {Ryo::YAML Ryo::YAML} module provides a number of options
5
+ # for coercing YAML data into a Ryo object. The methods of
6
+ # this module are available as singleton methods on the {Ryo Ryo}
7
+ # module
8
8
  module Ryo::YAML
9
- require "yaml"
10
9
  extend self
11
10
 
12
11
  ##
13
12
  # @example
14
13
  # Ryo.from_yaml(path: "/foo/bar/baz.yaml")
15
14
  # Ryo.from_yaml(string: "---\nfoo: bar\n")
16
- #
17
15
  # @param [String] path
18
16
  # The path to a YAML file
19
- #
20
17
  # @param [String] string
21
18
  # A blob of YAML
22
- #
23
19
  # @param [Ryo] object
24
20
  # {Ryo::Object Ryo::Object}, or {Ryo::BasicObject Ryo::BasicObject}
25
21
  # Defaults to {Ryo::Object Ryo::Object}
26
- #
27
22
  # @raise [SystemCallError]
28
23
  # Might raise a number of Errno exceptions
29
- #
30
24
  # @return [Ryo::Object, Ryo::BasicObject]
31
25
  # Returns a Ryo object
32
26
  def from_yaml(path: nil, string: nil, object: Ryo::Object)
33
27
  if path && string
34
28
  raise ArgumentError, "Provide a path or string but not both"
35
29
  elsif path
30
+ require "yaml" unless defined?(YAML)
36
31
  object.from YAML.load_file(path)
37
32
  elsif string
33
+ require "yaml" unless defined?(YAML)
38
34
  object.from YAML.load(string)
39
35
  else
40
36
  raise ArgumentError, "No path or string provided"
41
37
  end
42
38
  end
43
-
44
39
  Ryo.extend(self)
45
40
  end
data/lib/ryo.rb CHANGED
@@ -15,6 +15,8 @@
15
15
  # point = Ryo.assign(Ryo({}), {x: 0}, {y: 0})
16
16
  # point.x # => 0
17
17
  module Ryo
18
+ require_relative "ryo/json"
19
+ require_relative "ryo/yaml"
18
20
  require_relative "ryo/utils"
19
21
  require_relative "ryo/reflect"
20
22
  require_relative "ryo/keywords"
@@ -92,9 +94,9 @@ module Ryo
92
94
 
93
95
  ##
94
96
  # @note
95
- # This method will first query self for a property,
96
- # and if the property is not found the query is sent
97
- # to {Ryo#__proto__ Ryo#__proto__} instead
97
+ # This method will first look for a property on self,
98
+ # and if it is not found then it will forward the query
99
+ # onto `Ryo#__proto__`
98
100
  # @param [String] property
99
101
  # The name of a property
100
102
  # @return [<Object, BasicObject>, nil]
data/ryo.rb.gemspec CHANGED
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency "rubocop-rspec", "~> 2.12"
20
20
  gem.add_development_dependency "standard", "~> 1.9"
21
21
  gem.add_development_dependency "test-cmd.rb", "~> 0.12"
22
+ gem.add_development_dependency "rake", "~> 13.2"
22
23
  end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "setup"
5
+ require "ryo"
6
+
7
+ person = Ryo.from({
8
+ name: "John",
9
+ age: 30,
10
+ address: {
11
+ street: "123 Main St",
12
+ city: "Anytown",
13
+ state: "AS",
14
+ zip: 12345
15
+ }
16
+ })
17
+ p [person.name, person.age, person.address.city]
18
+
19
+ ##
20
+ # ["John", 30, "Anytown"]
@@ -5,14 +5,14 @@ require_relative "setup"
5
5
  require "ryo"
6
6
 
7
7
  points = Ryo.from([
8
- {x: {to_i: 2}},
8
+ {x: 2},
9
9
  "foobar",
10
- {y: {to_i: 4}}
10
+ {y: 4}
11
11
  ])
12
12
 
13
- p points[0].x.to_i
13
+ p points[0].x
14
14
  p points[1]
15
- p points[2].y.to_i
15
+ p points[2].y
16
16
 
17
17
  ##
18
18
  # 2
@@ -6,10 +6,9 @@ require "ryo"
6
6
  require "ostruct"
7
7
 
8
8
  point = Ryo.from(
9
- OpenStruct.new(x: {to_i: 5}),
10
- Ryo.from(y: {to_i: 10})
9
+ OpenStruct.new(x: 5, y: 10)
11
10
  )
12
- p [point.x.to_i, point.y.to_i]
11
+ p [point.x, point.y]
13
12
 
14
13
  ##
15
14
  # [5, 10]
data/share/ryo.rb/NEWS ADDED
@@ -0,0 +1,11 @@
1
+ # -*- mode: org -*-
2
+
3
+ * vNEXT
4
+
5
+ **** Automatically require ~ryo/json~, ~ryo/yaml~
6
+ Both files are now required in ~lib/ryo.rb~, so they can be used
7
+ without requiring them separately
8
+
9
+ **** ~Ryo.delete!~ => ~Ryo.delete~
10
+ Other than the rename: ~Ryo.delete~ accepts an ~ancestors~ option,
11
+ and by default traverses the entire prototype chain
data/spec/readme_spec.rb CHANGED
@@ -5,7 +5,7 @@ require "test-cmd"
5
5
 
6
6
  RSpec.describe "README.md examples" do
7
7
  run_example = ->(file) do
8
- cmd("ruby", "share/ryo.rb/examples/#{file}")
8
+ cmd("ruby", "share/examples/ryo.rb/#{file}")
9
9
  end
10
10
 
11
11
  subject do
@@ -39,7 +39,7 @@ RSpec.describe "README.md examples" do
39
39
 
40
40
  context "when given 3.0_recursion_ryo_from.rb" do
41
41
  let(:file) { "3.0_recursion_ryo_from.rb" }
42
- it { is_expected.to eq("[0, 10]") }
42
+ it { is_expected.to eq("[\"John\", 30, \"Anytown\"]") }
43
43
  end
44
44
 
45
45
  context "when given 3.1_recursion_ryo_from_with_array.rb" do
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "setup"
4
- require "ryo/json"
4
+ require "json"
5
5
  require "fileutils"
6
6
 
7
7
  RSpec.describe Ryo::JSON do
@@ -47,7 +47,7 @@ RSpec.describe Ryo::Keywords do
47
47
  context "when a property is deleted from point_b" do
48
48
  subject { point_b.x }
49
49
  before { Ryo.delete(point_b, "x") }
50
- it { is_expected.to eq(0) }
50
+ it { is_expected.to eq(nil) }
51
51
  end
52
52
 
53
53
  context "when a property is deleted from both point_a / point_b" do
@@ -39,7 +39,7 @@ RSpec.describe "Prototypes" do
39
39
  subject { node_2.name }
40
40
  let(:node_1) { Ryo({name: "Node 1"}, root) }
41
41
  before { Ryo.delete(node_1, "name") }
42
- it { is_expected.to eq("root") }
42
+ it { is_expected.to eq(nil) }
43
43
  end
44
44
  end
45
45
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "setup"
4
- require "ryo/yaml"
4
+ require "yaml"
5
5
  require "fileutils"
6
6
 
7
7
  RSpec.describe Ryo::YAML do
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.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.12'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '13.2'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '13.2'
97
111
  description: Ryo implements prototype-based inheritance, in Ruby
98
112
  email:
99
113
  - 0x1eef@protonmail.com
@@ -108,7 +122,6 @@ files:
108
122
  - ".rubocop.yml"
109
123
  - ".yardopts"
110
124
  - Gemfile
111
- - LICENSE
112
125
  - README.md
113
126
  - Rakefile.rb
114
127
  - lib/ryo.rb
@@ -125,20 +138,22 @@ files:
125
138
  - lib/ryo/version.rb
126
139
  - lib/ryo/yaml.rb
127
140
  - ryo.rb.gemspec
128
- - share/ryo.rb/examples/1.0_prototypes_point_object.rb
129
- - share/ryo.rb/examples/1.1_prototypes_ryo_fn.rb
130
- - share/ryo.rb/examples/2.0_iteration_each.rb
131
- - share/ryo.rb/examples/2.1_iteration_map.rb
132
- - share/ryo.rb/examples/2.2_iteration_ancestors.rb
133
- - share/ryo.rb/examples/3.0_recursion_ryo_from.rb
134
- - share/ryo.rb/examples/3.1_recursion_ryo_from_with_array.rb
135
- - share/ryo.rb/examples/3.2_recursion_ryo_from_with_openstruct.rb
136
- - share/ryo.rb/examples/4.0_basicobject_ryo_basicobject.rb
137
- - share/ryo.rb/examples/4.1_basicobject_ryo_basicobject_from.rb
138
- - share/ryo.rb/examples/5_collisions_resolution_strategy.rb
139
- - share/ryo.rb/examples/6_beyond_hash_objects.rb
140
- - share/ryo.rb/examples/7_ryo_memo.rb
141
- - share/ryo.rb/examples/setup.rb
141
+ - share/examples/ryo.rb/1.0_prototypes_point_object.rb
142
+ - share/examples/ryo.rb/1.1_prototypes_ryo_fn.rb
143
+ - share/examples/ryo.rb/2.0_iteration_each.rb
144
+ - share/examples/ryo.rb/2.1_iteration_map.rb
145
+ - share/examples/ryo.rb/2.2_iteration_ancestors.rb
146
+ - share/examples/ryo.rb/3.0_recursion_ryo_from.rb
147
+ - share/examples/ryo.rb/3.1_recursion_ryo_from_with_array.rb
148
+ - share/examples/ryo.rb/3.2_recursion_ryo_from_with_openstruct.rb
149
+ - share/examples/ryo.rb/4.0_basicobject_ryo_basicobject.rb
150
+ - share/examples/ryo.rb/4.1_basicobject_ryo_basicobject_from.rb
151
+ - share/examples/ryo.rb/5_collisions_resolution_strategy.rb
152
+ - share/examples/ryo.rb/6_beyond_hash_objects.rb
153
+ - share/examples/ryo.rb/7_ryo_memo.rb
154
+ - share/examples/ryo.rb/setup.rb
155
+ - share/ryo.rb/LICENSE
156
+ - share/ryo.rb/NEWS
142
157
  - spec/readme_spec.rb
143
158
  - spec/ryo_basic_object_spec.rb
144
159
  - spec/ryo_enumerable_spec.rb
@@ -169,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
184
  - !ruby/object:Gem::Version
170
185
  version: '0'
171
186
  requirements: []
172
- rubygems_version: 3.5.13
187
+ rubygems_version: 3.5.23
173
188
  signing_key:
174
189
  specification_version: 4
175
190
  summary: Ryo implements prototype-based inheritance, in Ruby
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative "setup"
5
- require "ryo"
6
-
7
- point = Ryo.from({
8
- x: {to_i: 0},
9
- y: {to_i: 10}
10
- })
11
- p [point.x.to_i, point.y.to_i]
12
-
13
- ##
14
- # [0, 10]
File without changes