chain_options 0.1.0 → 1.1.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 +4 -4
- data/.gitlab-ci.yml +28 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +5 -1
- data/Gemfile.lock +71 -49
- data/README.md +8 -5
- data/Rakefile +2 -2
- data/chain_options.gemspec +18 -21
- data/lib/chain_options/integration.rb +0 -1
- data/lib/chain_options/option.rb +6 -6
- data/lib/chain_options/option_set.rb +7 -9
- data/lib/chain_options/test_integration/rspec.rb +20 -22
- data/lib/chain_options/util.rb +9 -10
- data/lib/chain_options/version.rb +1 -1
- data/lib/chain_options.rb +6 -6
- metadata +22 -66
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e4e2796176fa23dccc81a0c0e2d2fff0272e0f5a5472b45510a4028eb9213d7
|
4
|
+
data.tar.gz: b2afb17fe20d14e616cf4521df6be774e665174a564cd55aad21cb8da2073572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83a6f20a505de1eb9569196224017013ef739e475facbe7415cb139818c4d683ed7774c488d6ab9ab36f507b4af53e2c11a66602f88af802b3f5cc626121fec
|
7
|
+
data.tar.gz: dc254132a5c75f1d6ffe0e8fc4303e715b8bdcb8f4743883f09d73febf774e6758fa3afede10814a32b81bfee196222599580b6d3fc2a8e304d0dc9e4af66cf5
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
stages:
|
2
|
+
- test
|
3
|
+
|
4
|
+
variables:
|
5
|
+
BUNDLE_JOBS: 4
|
6
|
+
BUNDLE_RETRY: 3
|
7
|
+
COVERAGE_DIR: $CI_PROJECT_DIR/coverage
|
8
|
+
|
9
|
+
test:
|
10
|
+
stage: test
|
11
|
+
image: ruby:3.2
|
12
|
+
before_script:
|
13
|
+
- apt-get update -qq && apt-get install -y nodejs
|
14
|
+
- gem install bundler
|
15
|
+
- bundle install
|
16
|
+
script:
|
17
|
+
- bundle exec rspec --format progress --format RspecJunitFormatter --out $CI_PROJECT_DIR/rspec.xml
|
18
|
+
artifacts:
|
19
|
+
paths:
|
20
|
+
- coverage
|
21
|
+
- rspec.xml
|
22
|
+
reports:
|
23
|
+
coverage_report:
|
24
|
+
coverage_format: cobertura
|
25
|
+
path: coverage/coverage.xml
|
26
|
+
junit: rspec.xml
|
27
|
+
expire_in: 1 week
|
28
|
+
coverage: '/\(\d+.\d+\%\) covered/' # Parse coverage from RSpec output
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.6
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
7
|
# Specify your gem's dependencies in chain_options.gemspec
|
8
8
|
gemspec
|
9
|
+
|
10
|
+
gem 'simplecov', require: false
|
11
|
+
gem 'simplecov-cobertura', require: false
|
12
|
+
gem 'rspec_junit_formatter', require: false
|
data/Gemfile.lock
CHANGED
@@ -1,72 +1,94 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
chain_options (
|
4
|
+
chain_options (1.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
pry (0.12.2)
|
22
|
-
coderay (~> 1.1.0)
|
23
|
-
method_source (~> 0.9.0)
|
24
|
-
pry-byebug (3.6.0)
|
25
|
-
byebug (~> 10.0)
|
26
|
-
pry (~> 0.10)
|
27
|
-
rainbow (3.0.0)
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.1)
|
11
|
+
docile (1.4.1)
|
12
|
+
json (2.9.1)
|
13
|
+
language_server-protocol (3.17.0.4)
|
14
|
+
lint_roller (1.1.0)
|
15
|
+
parallel (1.26.3)
|
16
|
+
parser (3.3.7.0)
|
17
|
+
ast (~> 2.4.1)
|
18
|
+
racc
|
19
|
+
racc (1.8.1)
|
20
|
+
rainbow (3.1.1)
|
28
21
|
rake (10.5.0)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
rspec-
|
33
|
-
|
34
|
-
rspec-
|
35
|
-
rspec-
|
22
|
+
regexp_parser (2.10.0)
|
23
|
+
rexml (3.4.0)
|
24
|
+
rspec (3.13.0)
|
25
|
+
rspec-core (~> 3.13.0)
|
26
|
+
rspec-expectations (~> 3.13.0)
|
27
|
+
rspec-mocks (~> 3.13.0)
|
28
|
+
rspec-core (3.13.2)
|
29
|
+
rspec-support (~> 3.13.0)
|
30
|
+
rspec-expectations (3.13.3)
|
36
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.13.0)
|
33
|
+
rspec-mocks (3.13.2)
|
39
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
|
43
|
-
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-support (3.13.2)
|
37
|
+
rspec_junit_formatter (0.6.0)
|
38
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
39
|
+
rubocop (1.70.0)
|
40
|
+
json (~> 2.3)
|
41
|
+
language_server-protocol (>= 3.17.0)
|
44
42
|
parallel (~> 1.10)
|
45
|
-
parser (>=
|
46
|
-
powerpack (~> 0.1)
|
43
|
+
parser (>= 3.3.0.2)
|
47
44
|
rainbow (>= 2.2.2, < 4.0)
|
45
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
46
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
48
47
|
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (
|
50
|
-
|
51
|
-
|
48
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
49
|
+
rubocop-ast (1.38.0)
|
50
|
+
parser (>= 3.3.1.0)
|
51
|
+
rubocop-performance (1.23.1)
|
52
|
+
rubocop (>= 1.48.1, < 2.0)
|
53
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
54
|
+
ruby-progressbar (1.13.0)
|
55
|
+
simplecov (0.22.0)
|
52
56
|
docile (~> 1.1)
|
53
|
-
|
54
|
-
|
55
|
-
simplecov-
|
56
|
-
|
57
|
+
simplecov-html (~> 0.11)
|
58
|
+
simplecov_json_formatter (~> 0.1)
|
59
|
+
simplecov-cobertura (2.1.0)
|
60
|
+
rexml
|
61
|
+
simplecov (~> 0.19)
|
62
|
+
simplecov-html (0.13.1)
|
63
|
+
simplecov_json_formatter (0.1.4)
|
64
|
+
standard (1.44.0)
|
65
|
+
language_server-protocol (~> 3.17.0.2)
|
66
|
+
lint_roller (~> 1.0)
|
67
|
+
rubocop (~> 1.70.0)
|
68
|
+
standard-custom (~> 1.0.0)
|
69
|
+
standard-performance (~> 1.6)
|
70
|
+
standard-custom (1.0.2)
|
71
|
+
lint_roller (~> 1.0)
|
72
|
+
rubocop (~> 1.50)
|
73
|
+
standard-performance (1.6.0)
|
74
|
+
lint_roller (~> 1.1)
|
75
|
+
rubocop-performance (~> 1.23.0)
|
76
|
+
unicode-display_width (3.1.4)
|
77
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
78
|
+
unicode-emoji (4.0.4)
|
57
79
|
|
58
80
|
PLATFORMS
|
59
81
|
ruby
|
60
82
|
|
61
83
|
DEPENDENCIES
|
62
|
-
bundler (
|
84
|
+
bundler (>= 2.6.3)
|
63
85
|
chain_options!
|
64
|
-
pry (~> 0.12)
|
65
|
-
pry-byebug (~> 3.6)
|
66
86
|
rake (~> 10.0)
|
67
|
-
rspec (~> 3.
|
68
|
-
|
69
|
-
simplecov
|
87
|
+
rspec (~> 3.13)
|
88
|
+
rspec_junit_formatter
|
89
|
+
simplecov
|
90
|
+
simplecov-cobertura
|
91
|
+
standard (~> 1.44)
|
70
92
|
|
71
93
|
BUNDLED WITH
|
72
|
-
|
94
|
+
2.6.3
|
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
[](https://badge.fury.io/rb/chain_options)
|
2
2
|
[](https://codeclimate.com/github/lokalportal/chain_options/maintainability)
|
3
|
-
|
3
|
+

|
4
4
|
|
5
5
|
# ChainOptions
|
6
6
|
|
7
|
+
**Important**: Version `1.x` is only compatible with Ruby >= 3.1. If you're using an older Ruby version, try `0.x`
|
8
|
+
|
7
9
|
ChainOptions is a small gem which allows you to add non-destructive chainable options to
|
8
10
|
your classes. It is useful to incrementally build instances without overriding the previous
|
9
11
|
one and provides an easy-to-understand DSL to set options either through
|
@@ -77,9 +79,10 @@ When it's called with an argument, it will return a new instance of your class w
|
|
77
79
|
the option set to this value, when being called without an argument, it will return the current value.
|
78
80
|
|
79
81
|
```ruby
|
80
|
-
|
81
|
-
my_class.my_option('my value')
|
82
|
-
|
82
|
+
instance1 = MyClass.new
|
83
|
+
instance2 = my_class.my_option('my value')
|
84
|
+
instance1.my_option #=> nil
|
85
|
+
instance2.my_option #=> 'my value'
|
83
86
|
```
|
84
87
|
|
85
88
|
Please note that instance variables are currently not carried over to the new
|
data/Rakefile
CHANGED
data/chain_options.gemspec
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "chain_options/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
8
|
+
spec.name = "chain_options"
|
9
|
+
spec.version = ChainOptions::VERSION
|
10
|
+
spec.authors = ["Stefan Exner"]
|
11
|
+
spec.email = ["stex@stex.codes"]
|
12
12
|
|
13
|
-
spec.summary
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
16
|
-
spec.files
|
13
|
+
spec.summary = "DSL to add non(destructive).option(methods).to(objects)"
|
14
|
+
spec.homepage = "https://github.com/lopo-tech/chain_options"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
18
18
|
end
|
19
|
-
spec.bindir
|
20
|
-
spec.executables
|
21
|
-
spec.require_paths = [
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.required_ruby_version = [
|
23
|
+
spec.required_ruby_version = [">= 3.1"]
|
24
24
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
30
|
-
spec.add_development_dependency 'rubocop', '~> 0.60'
|
31
|
-
spec.add_development_dependency 'simplecov', '~> 0.16'
|
25
|
+
spec.add_development_dependency "bundler", ">= 2.6.3"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
28
|
+
spec.add_development_dependency "standard", "~> 1.44"
|
32
29
|
end
|
data/lib/chain_options/option.rb
CHANGED
@@ -8,7 +8,7 @@ module ChainOptions
|
|
8
8
|
class Option
|
9
9
|
# The Parameters that need to be turned into instance methods, if they are symbols.
|
10
10
|
METHOD_SYMBOLS = %i[filter validate].freeze
|
11
|
-
PARAMETERS
|
11
|
+
PARAMETERS = %i[incremental default transform filter validate invalid allow_block].freeze
|
12
12
|
|
13
13
|
(PARAMETERS - [:allow_block]).each do |param|
|
14
14
|
define_method(param) { options[param] }
|
@@ -36,14 +36,14 @@ module ChainOptions
|
|
36
36
|
value = value_from_args(args, &block)
|
37
37
|
|
38
38
|
value = if incremental
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
incremental_value(value)
|
40
|
+
else
|
41
|
+
filter_value(transformed_value(value))
|
42
|
+
end
|
43
43
|
|
44
44
|
if value_valid?(value)
|
45
45
|
self.custom_value = value
|
46
|
-
elsif invalid.to_s ==
|
46
|
+
elsif invalid.to_s == "default" && !incremental
|
47
47
|
default_value
|
48
48
|
else
|
49
49
|
fail ArgumentError, "The value #{value.inspect} is not valid."
|
@@ -2,15 +2,13 @@
|
|
2
2
|
|
3
3
|
module ChainOptions
|
4
4
|
class OptionSet
|
5
|
-
|
6
5
|
class << self
|
7
|
-
|
8
6
|
#
|
9
7
|
# Warns of incompatible options for a chain_option.
|
10
8
|
# This does not necessarily mean that an error will be raised.
|
11
9
|
#
|
12
10
|
def warn_incompatible_options(option_name, *options)
|
13
|
-
|
11
|
+
warn "The options #{options.join(", ")} are incompatible for the chain_option #{option_name}."
|
14
12
|
end
|
15
13
|
|
16
14
|
#
|
@@ -18,9 +16,9 @@ module ChainOptions
|
|
18
16
|
#
|
19
17
|
def handle_warnings(name, incremental: false, invalid: :raise, filter: nil, transform: nil, **)
|
20
18
|
if incremental
|
21
|
-
warn_incompatible_options(name,
|
22
|
-
warn_incompatible_options(name,
|
23
|
-
warn_incompatible_options(name,
|
19
|
+
warn_incompatible_options(name, "invalid: :default", "incremental: true") if invalid.to_s == "default"
|
20
|
+
warn_incompatible_options(name, "incremental: true", "filter:") if filter
|
21
|
+
warn_incompatible_options(name, "incremental: true", "transform:") if transform
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -33,8 +31,8 @@ module ChainOptions
|
|
33
31
|
# named options.
|
34
32
|
#
|
35
33
|
def initialize(instance, chain_options = {}, values = {})
|
36
|
-
@instance
|
37
|
-
@values
|
34
|
+
@instance = instance
|
35
|
+
@values = values
|
38
36
|
@chain_options = chain_options.inject({}) do |options, (name, config)|
|
39
37
|
options.merge(name => config.merge(instance_method_hash(config)))
|
40
38
|
end
|
@@ -85,7 +83,7 @@ module ChainOptions
|
|
85
83
|
current_value(option_name)
|
86
84
|
else
|
87
85
|
new_value = new_value(option_name, *args, &block)
|
88
|
-
instance.class.new(
|
86
|
+
instance.class.new(**@values.merge(option_name.to_sym => new_value))
|
89
87
|
end
|
90
88
|
end
|
91
89
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rspec/expectations"
|
4
4
|
|
5
5
|
#
|
6
6
|
# Custom matcher to test for chain option behaviour.
|
@@ -38,19 +38,19 @@ module ChainOptions
|
|
38
38
|
match do |instance|
|
39
39
|
unless chain_option?(instance)
|
40
40
|
error_lines "Expected the class `#{instance.class}`",
|
41
|
-
|
42
|
-
|
41
|
+
"to define the chain option `:#{option_name}`,",
|
42
|
+
"but it didn't."
|
43
43
|
next false
|
44
44
|
end
|
45
45
|
|
46
|
-
if instance_variable_defined?(
|
46
|
+
if instance_variable_defined?(:@expected_default_value)
|
47
47
|
next false unless correct_default_value?(instance)
|
48
48
|
end
|
49
49
|
|
50
|
-
if instance_variable_defined?(
|
50
|
+
if instance_variable_defined?(:@given_value)
|
51
51
|
if @exception_expected
|
52
52
|
check_for_exception(instance)
|
53
|
-
elsif instance_variable_defined?(
|
53
|
+
elsif instance_variable_defined?(:@expected_value)
|
54
54
|
check_for_expected_value(instance)
|
55
55
|
end
|
56
56
|
end
|
@@ -59,7 +59,7 @@ module ChainOptions
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def error_lines(*lines)
|
62
|
-
@error = lines[1
|
62
|
+
@error = lines[1..].reduce(lines.first) do |error_string, line|
|
63
63
|
error_string + "\n #{line}"
|
64
64
|
end
|
65
65
|
end
|
@@ -73,30 +73,28 @@ module ChainOptions
|
|
73
73
|
next true if actual_default_value == @expected_default_value
|
74
74
|
|
75
75
|
error_lines "Expected the chain option `:#{option_name}`",
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
"of the class `#{instance.class}`",
|
77
|
+
"to have the default value `#{@expected_default_value.inspect}`",
|
78
|
+
"but the actual default value is `#{actual_default_value.inspect}`"
|
79
79
|
end
|
80
80
|
|
81
81
|
define_method :check_for_exception do |instance|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
raise unless e.message.include?('not valid')
|
89
|
-
end
|
82
|
+
instance.send(option_name, @given_value)
|
83
|
+
error_lines "Expected the chain option `:#{option_name}`",
|
84
|
+
"not to accept the value `#{@given_value.inspect}`,",
|
85
|
+
"but it did."
|
86
|
+
rescue ArgumentError => e
|
87
|
+
raise unless e.message.include?("not valid")
|
90
88
|
end
|
91
89
|
|
92
90
|
define_method :check_for_expected_value do |instance|
|
93
91
|
actual_value = instance.send(option_name, @given_value).send(option_name)
|
94
92
|
if actual_value != @expected_value
|
95
93
|
error_lines "Expected the chain option `:#{option_name}`",
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
"of the class `#{instance.class}`",
|
95
|
+
"to accept the value `#{@given_value.inspect}`",
|
96
|
+
"and set the option value to `#{@expected_value.inspect}`,",
|
97
|
+
"but it was set to `#{actual_value.inspect}`"
|
100
98
|
end
|
101
99
|
end
|
102
100
|
|
data/lib/chain_options/util.rb
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
module ChainOptions
|
4
4
|
module Util
|
5
|
-
|
6
5
|
def self.blank?(obj)
|
7
|
-
(obj.is_a?(Enumerable) && obj.empty?) || obj.nil? || obj ==
|
6
|
+
(obj.is_a?(Enumerable) && obj.empty?) || obj.nil? || obj == ""
|
8
7
|
end
|
9
8
|
|
10
9
|
def self.slice(hash, keys)
|
@@ -36,7 +35,7 @@ module ChainOptions
|
|
36
35
|
class ContextBoundDelegate
|
37
36
|
class << self
|
38
37
|
def instance_eval_with_context(receiver, &block)
|
39
|
-
calling_context = eval(
|
38
|
+
calling_context = eval("self", block.binding, __FILE__, __LINE__)
|
40
39
|
|
41
40
|
parent_calling_context = calling_context.instance_eval do
|
42
41
|
@__calling_context__ if defined?(@__calling_context__)
|
@@ -49,8 +48,8 @@ module ChainOptions
|
|
49
48
|
private :new
|
50
49
|
end
|
51
50
|
|
52
|
-
BASIC_METHODS = Set[:==, :equal?,
|
53
|
-
|
51
|
+
BASIC_METHODS = Set[:==, :equal?, :!, :"!=", :instance_eval,
|
52
|
+
:object_id, :__send__, :__id__]
|
54
53
|
|
55
54
|
instance_methods.each do |method|
|
56
55
|
unless BASIC_METHODS.include?(method.to_sym)
|
@@ -77,19 +76,19 @@ module ChainOptions
|
|
77
76
|
__proxy_method__(:sub, *args, &block)
|
78
77
|
end
|
79
78
|
|
80
|
-
def method_missing(method, *args, &block)
|
81
|
-
__proxy_method__(method, *args, &block)
|
79
|
+
def method_missing(method, *args, **kwargs, &block)
|
80
|
+
__proxy_method__(method, *args, **kwargs, &block)
|
82
81
|
end
|
83
82
|
|
84
83
|
def respond_to_missing?(meth)
|
85
84
|
@__receiver__.respond_to?(meth) || @__calling_context__.respond_to?(meth)
|
86
85
|
end
|
87
86
|
|
88
|
-
def __proxy_method__(method, *args, &block)
|
89
|
-
@__receiver__.__send__(method.to_sym, *args, &block)
|
87
|
+
def __proxy_method__(method, *args, **kwargs, &block)
|
88
|
+
@__receiver__.__send__(method.to_sym, *args, **kwargs, &block)
|
90
89
|
rescue ::NoMethodError => e
|
91
90
|
begin
|
92
|
-
@__calling_context__.__send__(method.to_sym, *args, &block)
|
91
|
+
@__calling_context__.__send__(method.to_sym, *args, **kwargs, &block)
|
93
92
|
rescue ::NoMethodError
|
94
93
|
raise(e)
|
95
94
|
end
|
data/lib/chain_options.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "chain_options/version"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
5
|
+
require "chain_options/util"
|
6
|
+
require "chain_options/option_set"
|
7
|
+
require "chain_options/option"
|
8
|
+
require "chain_options/integration"
|
9
|
+
require "chain_options/builder"
|
10
10
|
|
11
11
|
module ChainOptions
|
12
12
|
end
|
metadata
CHANGED
@@ -1,57 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chain_options
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Exner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
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
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.12'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
17
|
+
- - ">="
|
39
18
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry-byebug
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.6'
|
19
|
+
version: 2.6.3
|
48
20
|
type: :development
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
|
-
- - "
|
24
|
+
- - ">="
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
26
|
+
version: 2.6.3
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: rake
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,53 +44,41 @@ dependencies:
|
|
72
44
|
requirements:
|
73
45
|
- - "~>"
|
74
46
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.8'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.60'
|
47
|
+
version: '3.13'
|
90
48
|
type: :development
|
91
49
|
prerelease: false
|
92
50
|
version_requirements: !ruby/object:Gem::Requirement
|
93
51
|
requirements:
|
94
52
|
- - "~>"
|
95
53
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
54
|
+
version: '3.13'
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
56
|
+
name: standard
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - "~>"
|
102
60
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
61
|
+
version: '1.44'
|
104
62
|
type: :development
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
108
66
|
- - "~>"
|
109
67
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
description:
|
68
|
+
version: '1.44'
|
69
|
+
description:
|
112
70
|
email:
|
113
|
-
- stex@
|
71
|
+
- stex@stex.codes
|
114
72
|
executables: []
|
115
73
|
extensions: []
|
116
74
|
extra_rdoc_files: []
|
117
75
|
files:
|
118
76
|
- ".gitignore"
|
77
|
+
- ".gitlab-ci.yml"
|
119
78
|
- ".rspec"
|
120
79
|
- ".rubocop.yml"
|
121
|
-
- ".
|
80
|
+
- ".ruby-version"
|
81
|
+
- CHANGELOG.md
|
122
82
|
- Gemfile
|
123
83
|
- Gemfile.lock
|
124
84
|
- LICENSE.txt
|
@@ -135,11 +95,11 @@ files:
|
|
135
95
|
- lib/chain_options/test_integration/rspec.rb
|
136
96
|
- lib/chain_options/util.rb
|
137
97
|
- lib/chain_options/version.rb
|
138
|
-
homepage: https://github.com/
|
98
|
+
homepage: https://github.com/lopo-tech/chain_options
|
139
99
|
licenses:
|
140
100
|
- MIT
|
141
101
|
metadata: {}
|
142
|
-
post_install_message:
|
102
|
+
post_install_message:
|
143
103
|
rdoc_options: []
|
144
104
|
require_paths:
|
145
105
|
- lib
|
@@ -147,19 +107,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
107
|
requirements:
|
148
108
|
- - ">="
|
149
109
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
151
|
-
- - "<"
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '3'
|
110
|
+
version: '3.1'
|
154
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
112
|
requirements:
|
156
113
|
- - ">="
|
157
114
|
- !ruby/object:Gem::Version
|
158
115
|
version: '0'
|
159
116
|
requirements: []
|
160
|
-
|
161
|
-
|
162
|
-
signing_key:
|
117
|
+
rubygems_version: 3.4.19
|
118
|
+
signing_key:
|
163
119
|
specification_version: 4
|
164
120
|
summary: DSL to add non(destructive).option(methods).to(objects)
|
165
121
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.3.0
|
7
|
-
- 2.3.3
|
8
|
-
- 2.4.0
|
9
|
-
- 2.4.4
|
10
|
-
- 2.5.0
|
11
|
-
- 2.5.3
|
12
|
-
|
13
|
-
before_install: gem install bundler
|
14
|
-
|
15
|
-
before_script:
|
16
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
17
|
-
- chmod +x ./cc-test-reporter
|
18
|
-
- ./cc-test-reporter before-build
|
19
|
-
|
20
|
-
after_script:
|
21
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|