ryo.rb 0.4.4 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/.github/workflows/specs.yml +2 -2
  4. data/.gitignore +1 -0
  5. data/.gitlab-ci.yml +0 -0
  6. data/.projectile +6 -0
  7. data/.rubocop.yml +0 -0
  8. data/.yardopts +0 -0
  9. data/Gemfile +0 -0
  10. data/LICENSE +15 -0
  11. data/README.md +14 -5
  12. data/lib/ryo/basic_object.rb +0 -0
  13. data/lib/ryo/builder.rb +0 -0
  14. data/lib/ryo/enumerable.rb +0 -0
  15. data/lib/ryo/function.rb +0 -0
  16. data/lib/ryo/keywords.rb +0 -0
  17. data/lib/ryo/lazy.rb +0 -0
  18. data/lib/ryo/object.rb +0 -0
  19. data/lib/ryo/reflect.rb +0 -0
  20. data/lib/ryo/version.rb +1 -1
  21. data/lib/ryo.rb +7 -0
  22. data/ryo.rb.gemspec +0 -0
  23. data/share/ryo.rb/examples/1.0_prototypes_point_object.rb +0 -0
  24. data/share/ryo.rb/examples/1.1_prototypes_ryo_fn.rb +0 -0
  25. data/share/ryo.rb/examples/2.0_iteration_each.rb +0 -0
  26. data/share/ryo.rb/examples/2.1_iteration_map.rb +0 -0
  27. data/share/ryo.rb/examples/2.2_iteration_ancestors.rb +0 -0
  28. data/share/ryo.rb/examples/3.0_recursion_ryo_from.rb +0 -0
  29. data/share/ryo.rb/examples/3.1_recursion_ryo_from_with_array.rb +0 -0
  30. data/share/ryo.rb/examples/3.2_recursion_ryo_from_with_openstruct.rb +0 -0
  31. data/share/ryo.rb/examples/4.0_basicobject_ryo_basicobject.rb +0 -0
  32. data/share/ryo.rb/examples/4.1_basicobject_ryo_basicobject_from.rb +0 -0
  33. data/share/ryo.rb/examples/5_collisions_resolution_strategy.rb +0 -0
  34. data/share/ryo.rb/examples/6_beyond_hash_objects.rb +0 -0
  35. data/share/ryo.rb/examples/7_ryo_lazy.rb +0 -0
  36. data/share/ryo.rb/examples/setup.rb +0 -0
  37. data/spec/readme_spec.rb +0 -0
  38. data/spec/ryo_basic_object_spec.rb +8 -0
  39. data/spec/ryo_enumerable_spec.rb +0 -0
  40. data/spec/ryo_keywords_spec.rb +0 -0
  41. data/spec/ryo_object_spec.rb +8 -0
  42. data/spec/ryo_prototypes_spec.rb +0 -0
  43. data/spec/ryo_reflect_spec.rb +1 -1
  44. data/spec/ryo_spec.rb +0 -0
  45. data/spec/setup.rb +0 -0
  46. metadata +6 -8
  47. data/.yardoc-template/default/fulldoc/html/css/0x1eef.css +0 -15
  48. data/.yardoc-template/default/layout/html/setup.rb +0 -5
  49. data/.yardoc-template/default/module/setup.rb +0 -7
  50. data/LICENSE.txt +0 -22
  51. data/Rakefile +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61ffcab409332ea4c6979e302c9d27f467575ef2b8167f07805e7f20ad523002
4
- data.tar.gz: fb5f3050e9a373616e377a5d76c0605f7ce6e655ca8a2822619dd63d7426182d
3
+ metadata.gz: e90c5b42d1b364a6be77786df22b887017d3ce4965822f7152af7bcb1c617748
4
+ data.tar.gz: ec5d807404158d8dd1e9df47ee1fa15fb6be64ae2086942fbe9c1fd834be7331
5
5
  SHA512:
6
- metadata.gz: 1158833ffda85f18fabdb7f7830fe0a104f91bfe5d19d2f0d8a21e51ac5d95d34dd6744d100b0ba6e0c5c6ece7ecdd38a80f59f2ceb55898403d490de9be14b6
7
- data.tar.gz: c92c24f793503360539dc314c1c15d9349f23efee1cc29ca9af2dab497528d1b7186f77ee839f7ce36592c223ae6a4b8bdd058cb00091361a098268bad0e5af3
6
+ metadata.gz: ef8f408777db206d7fa5e3c7ced8d8a5fdfdaa15ad6e39f25921de20c421f0bef90d1aa1e474cbc6f6ab23d17fa314bd6513d3b9e322732d4adf21fb6c76b9c9
7
+ data.tar.gz: db93fad9aa4eeffdecbba86fa2ec970851eb007d3fecf0602e631584091f28d06dd3997464306267012bf893319f5209813b8cb99024e0281a5048da39f2a0a5
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_PATH: ".gems"
@@ -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: rspec -Ilib -rryo spec/
23
+ - run: bundle exec rspec
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ doc/
4
4
  .yardoc
5
5
  *.lock
6
6
  pkg/
7
+ .gems/
data/.gitlab-ci.yml CHANGED
File without changes
data/.projectile ADDED
@@ -0,0 +1,6 @@
1
+ +.
2
+ +.github
3
+ -.gems
4
+ -.git
5
+ -doc
6
+
data/.rubocop.yml CHANGED
File without changes
data/.yardopts CHANGED
File without changes
data/Gemfile CHANGED
File without changes
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,18 +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
 
358
- **Gemfile**
359
-
360
360
  ```ruby
361
- gem "ryo.rb", github: "0x1eef/ryo.rb", tag: "v0.4.4"
361
+ # Gemfile
362
+ gem "ryo.rb", github: "0x1eef/ryo.rb", tag: "v0.4.6"
362
363
  ```
363
364
 
365
+ **Rubygems.org**
366
+
367
+ Ryo can also be installed via rubygems.org.
368
+
369
+ gem install ryo.rb
370
+
364
371
  ## Thanks
365
372
 
366
373
  Thanks to
@@ -369,5 +376,7 @@ for the helpful discussions and advice.
369
376
 
370
377
  ## License
371
378
 
372
- This project is released under the terms of the MIT license. <br>
373
- See [./LICENSE.txt](./LICENSE.txt) for details.
379
+ [BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
380
+ <br>
381
+ See [LICENSE](./LICENSE).
382
+
File without changes
data/lib/ryo/builder.rb CHANGED
File without changes
File without changes
data/lib/ryo/function.rb CHANGED
File without changes
data/lib/ryo/keywords.rb CHANGED
File without changes
data/lib/ryo/lazy.rb CHANGED
File without changes
data/lib/ryo/object.rb CHANGED
File without changes
data/lib/ryo/reflect.rb CHANGED
File without changes
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.4.4"
4
+ VERSION = "0.4.6"
5
5
  end
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)
data/ryo.rb.gemspec CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/readme_spec.rb CHANGED
File without changes
@@ -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
File without changes
File without changes
@@ -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")
File without changes
@@ -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
data/spec/ryo_spec.rb CHANGED
File without changes
data/spec/setup.rb CHANGED
File without changes
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
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: 2023-12-13 00:00:00.000000000 Z
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.txt
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.4.10
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.
@@ -1,15 +0,0 @@
1
- #main #content #filecontents p, .discussion p, ul.param li, div.note {
2
- max-width: 768px;
3
- }
4
-
5
- #toc {
6
- position: fixed;
7
- right: 25px;
8
- display: none;
9
- }
10
-
11
- @media screen and (min-width: 1280px) {
12
- #toc {
13
- display: block;
14
- }
15
- }
@@ -1,5 +0,0 @@
1
- def stylesheets
2
- s = super
3
- s << "css/0x1eef.css"
4
- s
5
- end
@@ -1,7 +0,0 @@
1
- ##
2
- # Sort methods in ascending order based
3
- # on the line number where a method is
4
- # defined.
5
- def sort_listing(listing)
6
- listing.sort_by { _1.files[1] }
7
- end
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
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"