ryo.rb 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bundle/config +2 -0
- data/.github/workflows/specs.yml +2 -2
- data/.gitignore +1 -0
- data/.projectile +6 -0
- data/LICENSE +15 -0
- data/README.md +17 -2
- data/lib/ryo/version.rb +1 -1
- data/lib/ryo.rb +7 -0
- data/spec/ryo_basic_object_spec.rb +8 -0
- data/spec/ryo_object_spec.rb +8 -0
- data/spec/ryo_reflect_spec.rb +1 -1
- metadata +6 -8
- data/.yardoc-template/default/fulldoc/html/css/0x1eef.css +0 -15
- data/.yardoc-template/default/layout/html/setup.rb +0 -5
- data/.yardoc-template/default/module/setup.rb +0 -7
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90c5b42d1b364a6be77786df22b887017d3ce4965822f7152af7bcb1c617748
|
4
|
+
data.tar.gz: ec5d807404158d8dd1e9df47ee1fa15fb6be64ae2086942fbe9c1fd834be7331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef8f408777db206d7fa5e3c7ced8d8a5fdfdaa15ad6e39f25921de20c421f0bef90d1aa1e474cbc6f6ab23d17fa314bd6513d3b9e322732d4adf21fb6c76b9c9
|
7
|
+
data.tar.gz: db93fad9aa4eeffdecbba86fa2ec970851eb007d3fecf0602e631584091f28d06dd3997464306267012bf893319f5209813b8cb99024e0281a5048da39f2a0a5
|
data/.bundle/config
ADDED
data/.github/workflows/specs.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
14
|
os: [ubuntu-latest]
|
15
|
-
ruby: [3.1, 3.2]
|
15
|
+
ruby: [3.1, 3.2, 3.3]
|
16
16
|
runs-on: ${{ matrix.os }}
|
17
17
|
steps:
|
18
18
|
- uses: actions/checkout@v2
|
@@ -20,4 +20,4 @@ jobs:
|
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby }}
|
22
22
|
- run: bundle install
|
23
|
-
- run:
|
23
|
+
- run: bundle exec rspec
|
data/.gitignore
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Copyright (C) 2023 by 0x1eef <0x1eef@protonmail.com>
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this
|
4
|
+
software for any purpose with or without fee is hereby
|
5
|
+
granted.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS
|
8
|
+
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
9
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
10
|
+
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
12
|
+
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
13
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
14
|
+
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
15
|
+
OF THIS SOFTWARE.
|
data/README.md
CHANGED
@@ -349,12 +349,25 @@ p point.y # => 10
|
|
349
349
|
|
350
350
|
## <a id='install'>Install</a>
|
351
351
|
|
352
|
+
**Git**
|
353
|
+
|
352
354
|
Ryo is distributed as a RubyGem through its git repositories. <br>
|
353
355
|
[GitHub](https://github.com/0x1eef/ryo.rb),
|
354
356
|
and
|
355
357
|
[GitLab](https://gitlab.com/0x1eef/ryo.rb)
|
356
358
|
are available as sources.
|
357
359
|
|
360
|
+
```ruby
|
361
|
+
# Gemfile
|
362
|
+
gem "ryo.rb", github: "0x1eef/ryo.rb", tag: "v0.4.6"
|
363
|
+
```
|
364
|
+
|
365
|
+
**Rubygems.org**
|
366
|
+
|
367
|
+
Ryo can also be installed via rubygems.org.
|
368
|
+
|
369
|
+
gem install ryo.rb
|
370
|
+
|
358
371
|
## Thanks
|
359
372
|
|
360
373
|
Thanks to
|
@@ -363,5 +376,7 @@ for the helpful discussions and advice.
|
|
363
376
|
|
364
377
|
## License
|
365
378
|
|
366
|
-
|
367
|
-
|
379
|
+
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
|
380
|
+
<br>
|
381
|
+
See [LICENSE](./LICENSE).
|
382
|
+
|
data/lib/ryo/version.rb
CHANGED
data/lib/ryo.rb
CHANGED
@@ -152,6 +152,13 @@ module Ryo
|
|
152
152
|
Ryo.inspect_object(self)
|
153
153
|
end
|
154
154
|
|
155
|
+
##
|
156
|
+
# @return [Hash]
|
157
|
+
# Returns the hash table used by a Ryo object.
|
158
|
+
def to_h
|
159
|
+
Ryo.table_of(self, recursive: true)
|
160
|
+
end
|
161
|
+
|
155
162
|
##
|
156
163
|
# @private
|
157
164
|
def pretty_print(q)
|
@@ -57,4 +57,12 @@ RSpec.describe Ryo::BasicObject do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
describe "#to_h" do
|
62
|
+
subject(:h) { car.to_h }
|
63
|
+
let(:car) { Ryo.from(name: "ford", wheels: {quantity: 4}) }
|
64
|
+
it { expect(h).to be_instance_of(Hash) }
|
65
|
+
it { expect(h["wheels"]).to be_instance_of(Hash) }
|
66
|
+
it { expect(h).to eq({"name" => "ford", "wheels" => {"quantity" => 4}}) }
|
67
|
+
end
|
60
68
|
end
|
data/spec/ryo_object_spec.rb
CHANGED
@@ -53,6 +53,14 @@ RSpec.describe "Ryo objects" do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
describe "#to_h" do
|
57
|
+
subject(:h) { car.to_h }
|
58
|
+
let(:car) { Ryo.from(name: "ford", wheels: {quantity: 4}) }
|
59
|
+
it { expect(h).to be_instance_of(Hash) }
|
60
|
+
it { expect(h["wheels"]).to be_instance_of(Hash) }
|
61
|
+
it { expect(h).to eq({"name" => "ford", "wheels" => {"quantity" => 4}}) }
|
62
|
+
end
|
63
|
+
|
56
64
|
describe "when a property overshadows a method" do
|
57
65
|
let(:car) do
|
58
66
|
Ryo(tap: "property")
|
data/spec/ryo_reflect_spec.rb
CHANGED
@@ -148,7 +148,7 @@ RSpec.describe Ryo::Reflect do
|
|
148
148
|
context "without recursion" do
|
149
149
|
let(:recursive) { false }
|
150
150
|
context "when given a Ryo object" do
|
151
|
-
let(:ryo) { Ryo(x: 1, y:1) }
|
151
|
+
let(:ryo) { Ryo(x: 1, y: 1) }
|
152
152
|
it { is_expected.to be_instance_of(Hash) }
|
153
153
|
it { is_expected.to eq("x" => 1, "y" => 1) }
|
154
154
|
end
|
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.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -101,18 +101,16 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".bundle/config"
|
104
105
|
- ".github/workflows/specs.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".gitlab-ci.yml"
|
108
|
+
- ".projectile"
|
107
109
|
- ".rubocop.yml"
|
108
|
-
- ".yardoc-template/default/fulldoc/html/css/0x1eef.css"
|
109
|
-
- ".yardoc-template/default/layout/html/setup.rb"
|
110
|
-
- ".yardoc-template/default/module/setup.rb"
|
111
110
|
- ".yardopts"
|
112
111
|
- Gemfile
|
113
|
-
- LICENSE
|
112
|
+
- LICENSE
|
114
113
|
- README.md
|
115
|
-
- Rakefile
|
116
114
|
- lib/ryo.rb
|
117
115
|
- lib/ryo/basic_object.rb
|
118
116
|
- lib/ryo/builder.rb
|
@@ -166,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
164
|
- !ruby/object:Gem::Version
|
167
165
|
version: '0'
|
168
166
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.5.3
|
170
168
|
signing_key:
|
171
169
|
specification_version: 4
|
172
170
|
summary: Ryo implements prototype-based inheritance, in Ruby.
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright 2022
|
4
|
-
0x1eef
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
8
|
-
in the Software without restriction, including without limitation the rights
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
11
|
-
furnished to do so, subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.
|
data/Rakefile
DELETED