mother 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f3653ca2a0bc404a4d79bd8004e5356d287e69a423486d183dec936ba11eaa
4
- data.tar.gz: 8957b1ecdf5d50325dc51dd5958d5d38d19f5cb91c0b78cf245d1ed51a6e3044
3
+ metadata.gz: 33a5def0a908e53da17ab8a4e340593ec2e56d499d5b9516093f16018833536d
4
+ data.tar.gz: 891d7d4d47e155ce04647db9bcf0f75756bf25aa1f97c07e4efd0df217ec5c53
5
5
  SHA512:
6
- metadata.gz: 9d17bb9d03c92e57e648114a934d65440120eb94d42922b4e6f0b17ca86ed24a79f48b884df6449d103c1fbe6dbe2b8f417e5ac3d05b63f461b24e76fec2d66e
7
- data.tar.gz: 7e7b6217894632795a3a8d070333711cde88b648bdfde1bc656636f387666ee1d0a4ac975dc30dd084395d669aa80a4237062cc64a18e861f32c747440c44161
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
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.2.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,11 +17,11 @@ class Mother
17
17
  end
18
18
 
19
19
  def keys
20
- @data.keys
20
+ self.class.create @data.keys
21
21
  end
22
22
 
23
23
  def values
24
- @data.values
24
+ self.class.create @data.values
25
25
  end
26
26
 
27
27
  def method_missing(method, *args, &block)
@@ -45,22 +45,17 @@ class Mother
45
45
  Collection.new self, thing
46
46
  when Hash
47
47
  new thing
48
- when String
49
- case
50
- when thing.match(/\.ya?ml$/)
51
- self.create YAML.load(File.read(thing))
52
- when thing.match(/\.json$/)
53
- self.create JSON.parse(File.read(thing))
54
- else
55
- thing
56
- end
48
+ when String && /\.ya?ml$/
49
+ create YAML.load(File.read(thing))
50
+ when String && /\.json$/
51
+ create JSON.parse(File.read(thing))
57
52
  else
58
53
  thing
59
54
  end
60
55
  end
61
56
 
62
57
  def argument_failure!
63
- raise ArgumentError.new('Must be a hash, or YAML/JSON filename')
58
+ raise ArgumentError.new("Must be a hash, or YAML/JSON filename")
64
59
  end
65
60
  end
66
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.2.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: 2020-01-02 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,8 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
120
  - !ruby/object:Gem::Version
135
121
  version: '0'
136
122
  requirements: []
137
- rubygems_version: 3.0.3
138
- signing_key:
123
+ rubygems_version: 3.3.3
124
+ signing_key:
139
125
  specification_version: 4
140
126
  summary: Method-ized access to a hash's children, and their children.
141
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