ryo.rb 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +11 -32
- data/lib/ryo/builder.rb +1 -1
- data/lib/ryo/json.rb +2 -0
- data/lib/ryo/version.rb +1 -1
- data/ryo.rb.gemspec +2 -2
- data/spec/readme_spec.rb +1 -1
- data/spec/ryo_object_spec.rb +9 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad842754d7d2a619c1fd552527e519b41ddf36f704c7d4b02f2f367b0f2ee1d
|
4
|
+
data.tar.gz: 2457cc1cf78cfb725b8f35c5c0a4cce01c35896f0a3ed0ac32a19faeb45b0177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cc4d227f2a157b112ae5ae3275062e5ba1b1241d9122c89341859a342d05d558abf4f89bed034a629a5f4f9cda966a47e794f22e9e3fede8e136a758fcd2a1c
|
7
|
+
data.tar.gz: f513c798461f72270fa247cc927591ae1ec26dd3e0d9606ea7bf81936063fa0026847699f6d233c93505dc891e1111560cbbd7a53d019e0fb033166d58d036a1
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,13 +2,6 @@
|
|
2
2
|
|
3
3
|
Ryo implements prototype-based inheritance, in Ruby.
|
4
4
|
|
5
|
-
Ryo's implementation of prototype-based inheritance offers
|
6
|
-
a flexible approach for establishing object relationships,
|
7
|
-
and building configuration objects. Ryo can also act as a
|
8
|
-
recursive OpenStruct alternative. JavaScript's implementation of
|
9
|
-
prototype-based inheritance served as a reference point
|
10
|
-
for Ryo's implementation.
|
11
|
-
|
12
5
|
## Examples
|
13
6
|
|
14
7
|
### Prototypes
|
@@ -308,7 +301,7 @@ p ryo.then { 34 } # => 34
|
|
308
301
|
#### Duck typing
|
309
302
|
|
310
303
|
The documentation has used simple terms to describe the objects that Ryo works
|
311
|
-
with: Hash and Array objects. But
|
304
|
+
with: Hash and Array objects. But in reality, Ryo uses duck typing, so any object
|
312
305
|
that implements `#each_pair` can be treated as a Hash object, and any object that
|
313
306
|
implements `#each` can be treated as an Array object. Note that only
|
314
307
|
[Ryo.from](https://0x1eef.github.io/x/ryo.rb/Ryo.html#from-class_method),
|
@@ -340,41 +333,27 @@ p point.x # => 5
|
|
340
333
|
p point.y # => 10
|
341
334
|
```
|
342
335
|
|
343
|
-
##
|
344
|
-
|
345
|
-
* [Source code (GitHub)](https://github.com/0x1eef/ryo.rb#readme)
|
346
|
-
* [Source code (GitLab)](https://gitlab.com/0x1eef/ryo.rb#about)
|
347
|
-
|
348
|
-
## <a id='install'>Install</a>
|
349
|
-
|
350
|
-
**Git**
|
351
|
-
|
352
|
-
Ryo is distributed as a RubyGem through its git repositories. <br>
|
353
|
-
[GitHub](https://github.com/0x1eef/ryo.rb),
|
354
|
-
and
|
355
|
-
[GitLab](https://gitlab.com/0x1eef/ryo.rb)
|
356
|
-
are available as sources.
|
357
|
-
|
358
|
-
```ruby
|
359
|
-
# Gemfile
|
360
|
-
gem "ryo.rb", github: "0x1eef/ryo.rb", tag: "v0.4.7"
|
361
|
-
```
|
336
|
+
## Install
|
362
337
|
|
363
338
|
**Rubygems.org**
|
364
339
|
|
365
|
-
Ryo can
|
340
|
+
Ryo can be installed via rubygems.org:
|
366
341
|
|
367
342
|
gem install ryo.rb
|
368
343
|
|
344
|
+
## Sources
|
345
|
+
|
346
|
+
* [GitHub](https://github.com/0x1eef/ryo.rb#readme)
|
347
|
+
* [GitLab](https://gitlab.com/0x1eef/ryo.rb#about)
|
348
|
+
|
369
349
|
## Thanks
|
370
350
|
|
371
351
|
Thanks to
|
372
352
|
[@awfulcooking (mooff)](https://github.com/awfulcooking)
|
373
|
-
for the helpful discussions and advice
|
353
|
+
for the helpful discussions, ideas, and advice
|
374
354
|
|
375
355
|
## License
|
376
356
|
|
377
|
-
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/)
|
357
|
+
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/)
|
378
358
|
<br>
|
379
|
-
See [LICENSE](./LICENSE)
|
380
|
-
|
359
|
+
See [LICENSE](./LICENSE)
|
data/lib/ryo/builder.rb
CHANGED
@@ -26,7 +26,7 @@ module Ryo::Builder
|
|
26
26
|
# returned in its place.
|
27
27
|
def self.build(buildee, props, prototype = nil)
|
28
28
|
if Ryo.ryo?(props)
|
29
|
-
build(
|
29
|
+
build(buildee, Ryo.table_of(props), prototype || Ryo.prototype_of(props))
|
30
30
|
else
|
31
31
|
ryo = buildee.new
|
32
32
|
Ryo.set_prototype_of(ryo, prototype)
|
data/lib/ryo/json.rb
CHANGED
data/lib/ryo/version.rb
CHANGED
data/ryo.rb.gemspec
CHANGED
@@ -10,12 +10,12 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.licenses = ["MIT"]
|
11
11
|
gem.files = `git ls-files`.split($/)
|
12
12
|
gem.require_paths = ["lib"]
|
13
|
-
gem.description = "Ryo implements prototype-based inheritance, in Ruby
|
13
|
+
gem.description = "Ryo implements prototype-based inheritance, in Ruby"
|
14
14
|
gem.summary = gem.description
|
15
15
|
gem.add_development_dependency "yard", "~> 0.9"
|
16
16
|
gem.add_development_dependency "redcarpet", "~> 3.5"
|
17
17
|
gem.add_development_dependency "rspec", "~> 3.10"
|
18
18
|
gem.add_development_dependency "rubocop-rspec", "~> 2.12"
|
19
19
|
gem.add_development_dependency "standard", "~> 1.9"
|
20
|
-
gem.add_development_dependency "test-cmd.rb", "~> 0.
|
20
|
+
gem.add_development_dependency "test-cmd.rb", "~> 0.12"
|
21
21
|
end
|
data/spec/readme_spec.rb
CHANGED
data/spec/ryo_object_spec.rb
CHANGED
@@ -5,6 +5,15 @@ require_relative "setup"
|
|
5
5
|
RSpec.describe "Ryo objects" do
|
6
6
|
let(:car) { Ryo(name: "Car") }
|
7
7
|
|
8
|
+
describe "Kernel#Ryo" do
|
9
|
+
context "when given a Ryo object" do
|
10
|
+
subject { Ryo(ryo) }
|
11
|
+
let(:ryo) { Ryo(name: "Car") }
|
12
|
+
|
13
|
+
it { is_expected.to be_instance_of(Ryo::Object) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
8
17
|
describe "#respond_to?" do
|
9
18
|
context "when a property is defined" do
|
10
19
|
subject { car.respond_to?(:name) }
|
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.2
|
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-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -86,15 +86,15 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.12'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
97
|
-
description: Ryo implements prototype-based inheritance, in Ruby
|
96
|
+
version: '0.12'
|
97
|
+
description: Ryo implements prototype-based inheritance, in Ruby
|
98
98
|
email:
|
99
99
|
- 0x1eef@protonmail.com
|
100
100
|
executables: []
|
@@ -166,8 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.5.
|
169
|
+
rubygems_version: 3.5.9
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
|
-
summary: Ryo implements prototype-based inheritance, in Ruby
|
172
|
+
summary: Ryo implements prototype-based inheritance, in Ruby
|
173
173
|
test_files: []
|