mother 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a67400fbd3434ab48672cbb60695a344d0ba8087
4
- data.tar.gz: c5564367ecac57cc878175de55b3c5e6b66c5178
2
+ SHA256:
3
+ metadata.gz: 33a5def0a908e53da17ab8a4e340593ec2e56d499d5b9516093f16018833536d
4
+ data.tar.gz: 891d7d4d47e155ce04647db9bcf0f75756bf25aa1f97c07e4efd0df217ec5c53
5
5
  SHA512:
6
- metadata.gz: ae5380c102c646f17fe497b00773c4a2900dc22a29f03bf44fccf76e63d6ede42060d01623ad705459f091cabc39e28ba5b240a2d7450c9fced2857ab791caf9
7
- data.tar.gz: 7362f01bcb616d9b4f9ea2a58d384936a248ffb06cc3922b450680d39afdc743fda52f7abc5d5725766055161b43f77f0c39c608c03d6b336c203a679f689ba1
6
+ metadata.gz: bc14525f1bc70e14affa1789a78e77516a358ce3ea3f55b8c9bd03ffbe622168e6fe83f7a4c9589dd7bc06cf640b0560e429ce3491c34fa820db1109e5be6d12
7
+ data.tar.gz: 77fba8530391d2b04197eee1d1fdbbd77763f44cb9b95daf3343bfabc7917d0b6e943f811bc9c4bc2b166d9aa5e3e63832fabd749ee6d1d031e4efdae5c13c7f
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.7', '3.1']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in mother.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Tested](https://github.com/joelhelbling/mother/actions/workflows/ruby.yml/badge.svg)
2
+
1
3
  # Mother
2
4
 
3
5
  In the culinary world, "mother" is a natural complex of bacteria, proteins, enzymes and
@@ -170,19 +172,15 @@ file to [rubygems.org](https://rubygems.org).
170
172
 
171
173
  Bug reports and pull requests are welcome on GitHub at https://github.com/joelhelbling/mother.
172
174
  This project is intended to be a safe, welcoming space for collaboration, and contributors are
173
- expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org) code of
174
- conduct.
175
+ expected to adhere to the [code of conduct][code_of_conduct].
175
176
 
176
177
  ## License
177
178
 
178
179
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
179
180
 
180
- ## Code of Conduct
181
-
182
- Everyone interacting in Mother’s codebases, issue trackers, chat rooms and mailing lists shoulds
183
- expect to follow the [code of conduct](https://github.com/joelhelbling/mother/blob/master/CODE_OF_CONDUCT.md).
184
-
185
181
  ## Dedication
186
182
 
187
183
  _I'd like to dedicate this gem to my Mom, who taught me to think analytically, who was my first
188
184
  and best math teacher, and who encourages me to do my best, even nowadays. I love you, Mom._
185
+
186
+ [code_of_conduct]: https://github.com/joelhelbling/mother/blob/master/CODE_OF_CONDUCT.md
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -24,7 +24,7 @@ class Mother
24
24
  end
25
25
 
26
26
  def each(&block)
27
- data.map{ |i| mother.create i }.each(&block)
27
+ data.map { |i| mother.create i }.each(&block)
28
28
  end
29
29
  end
30
30
  end
@@ -1,3 +1,3 @@
1
1
  class Mother
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/mother.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'mother/version'
2
- require 'mother/collection'
3
- require 'yaml'
4
- require 'json'
1
+ require "mother/version"
2
+ require "mother/collection"
3
+ require "yaml"
4
+ require "json"
5
5
 
6
6
  class Mother
7
7
  attr_reader :data
@@ -17,13 +17,21 @@ class Mother
17
17
  end
18
18
 
19
19
  def keys
20
- @data.keys
20
+ self.class.create @data.keys
21
+ end
22
+
23
+ def values
24
+ self.class.create @data.values
21
25
  end
22
26
 
23
27
  def method_missing(method, *args, &block)
24
28
  self[method]
25
29
  end
26
30
 
31
+ def respond_to_missing?(method, include_private = true)
32
+ keys.include?(method) || keys.include?(method.to_s) || super
33
+ end
34
+
27
35
  private
28
36
 
29
37
  def ___fetch(key)
@@ -37,22 +45,17 @@ class Mother
37
45
  Collection.new self, thing
38
46
  when Hash
39
47
  new thing
40
- when String
41
- case
42
- when thing.match(/\.ya?ml$/)
43
- self.create YAML.load(File.read(thing))
44
- when thing.match(/\.json$/)
45
- self.create JSON.parse(File.read(thing))
46
- else
47
- thing
48
- end
48
+ when String && /\.ya?ml$/
49
+ create YAML.load(File.read(thing))
50
+ when String && /\.json$/
51
+ create JSON.parse(File.read(thing))
49
52
  else
50
53
  thing
51
54
  end
52
55
  end
53
56
 
54
57
  def argument_failure!
55
- raise ArgumentError.new('Must be a hash, or YAML/JSON filename')
58
+ raise ArgumentError.new("Must be a hash, or YAML/JSON filename")
56
59
  end
57
60
  end
58
61
  end
data/mother.gemspec CHANGED
@@ -1,32 +1,30 @@
1
-
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "mother/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "mother"
8
- spec.version = Mother::VERSION
9
- spec.authors = ["Joel Helbling"]
10
- spec.email = ["joel@joelhelbling.com"]
6
+ spec.name = "mother"
7
+ spec.version = Mother::VERSION
8
+ spec.authors = ["Joel Helbling"]
9
+ spec.email = ["joel@joelhelbling.com"]
11
10
 
12
- spec.summary = %q{Method-ized access to a hash's children, and their children.}
13
- spec.description = %q{Ever wish you had effortless, JS-like access to a deeply nested yaml?}
14
- spec.homepage = "https://mother.joelhelbling.com"
15
- spec.license = "MIT"
11
+ spec.summary = "Method-ized access to a hash's children, and their children."
12
+ spec.description = "Ever wish you had effortless, JS-like access to a deeply nested yaml?"
13
+ spec.homepage = "https://mother.joelhelbling.com"
14
+ spec.license = "MIT"
16
15
 
17
16
  # Specify which files should be added to the gem when it is released.
18
17
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
20
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
20
  end
22
- spec.bindir = "exe"
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
23
  spec.require_paths = ["lib"]
25
24
 
26
- spec.add_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "rake", "~> 12.3"
28
- spec.add_development_dependency "rspec", "~> 3.8"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
+ spec.add_development_dependency "rspec", "~> 3.11"
29
27
  spec.add_development_dependency "rspec-given", "~> 3.8"
30
- spec.add_development_dependency "fakefs", "0.18.0"
28
+ spec.add_development_dependency "fakefs", "1.8"
31
29
  spec.add_development_dependency "pry"
32
30
  end
metadata CHANGED
@@ -1,57 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mother
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Helbling
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.16'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '12.3'
19
+ version: '13.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '12.3'
26
+ version: '13.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '3.8'
33
+ version: '3.11'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '3.8'
40
+ version: '3.11'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec-given
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +58,14 @@ dependencies:
72
58
  requirements:
73
59
  - - '='
74
60
  - !ruby/object:Gem::Version
75
- version: 0.18.0
61
+ version: '1.8'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - '='
81
67
  - !ruby/object:Gem::Version
82
- version: 0.18.0
68
+ version: '1.8'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: pry
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -101,9 +87,9 @@ executables: []
101
87
  extensions: []
102
88
  extra_rdoc_files: []
103
89
  files:
90
+ - ".github/workflows/ruby.yml"
104
91
  - ".gitignore"
105
92
  - ".rspec"
106
- - ".travis.yml"
107
93
  - CODE_OF_CONDUCT.md
108
94
  - Gemfile
109
95
  - LICENSE.txt
@@ -119,7 +105,7 @@ homepage: https://mother.joelhelbling.com
119
105
  licenses:
120
106
  - MIT
121
107
  metadata: {}
122
- post_install_message:
108
+ post_install_message:
123
109
  rdoc_options: []
124
110
  require_paths:
125
111
  - lib
@@ -134,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
120
  - !ruby/object:Gem::Version
135
121
  version: '0'
136
122
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.6.14.1
139
- signing_key:
123
+ rubygems_version: 3.3.3
124
+ signing_key:
140
125
  specification_version: 4
141
126
  summary: Method-ized access to a hash's children, and their children.
142
127
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.1
7
- before_install: gem install bundler -v 1.16.4