defi 2.0.4 → 2.0.5

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
2
  SHA256:
3
- metadata.gz: a2ca2a81be0ee760282fe5770efa1d904340038738e18fc2a40f096bd6b134f7
4
- data.tar.gz: b05c6ff311cfefed5bf83658b6724f9e50e18540eac9f60d34d63cd6c8b5bbed
3
+ metadata.gz: 5a5d9ec9fab69bff15c96a7cc69fa4803ae518de50757ec42b4e2f2189df4ae8
4
+ data.tar.gz: 942186c2634f4ed5fafd96fa811444105ac6b0983627d1bb2023e004dfb403df
5
5
  SHA512:
6
- metadata.gz: 80ab8c348a30fea63fd20999d66f5ab7ccf5b75625c2c586362e1cd5e382c0c50078b03466043f67ba148f09e124bec27b0bce1b1809356fcac9fd02f6061dc4
7
- data.tar.gz: 157e0feba92506feb2f005078e85179ea005a3040d1907c812972c7aec57d9c9d4f901ec2562de41346807dfe70d434063d444d311e1b83881ea7940e8375697
6
+ metadata.gz: 780386f4f728d69dc3b904b0773fc6a01c712d9f8857102cd3e0a142a5400cff2db9f2ae2693a682bfe3c83a83ab3d1fad743d44db4495d0ed398155c081755b
7
+ data.tar.gz: 2d7352dd2e198709f43de97312e904836a6fc00a234c5b31b5cb4e01dc3904f6b43ed70828578e635bb0cdd80531b20ad84eafaf5c21eae3a3881d26f5414516
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2020 Cyril Kato
3
+ Copyright (c) 2015-2021 Cyril Kato
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Defi
2
2
 
3
- [![Build Status](https://api.travis-ci.org/fixrb/defi.svg?branch=master)][travis]
3
+ [![Build Status](https://api.travis-ci.org/fixrb/defi.svg?branch=main)][travis]
4
4
  [![Gem Version](https://badge.fury.io/rb/defi.svg)][gem]
5
- [![Inline docs](https://inch-ci.org/github/fixrb/defi.svg?branch=master)][inchpages]
5
+ [![Inline docs](https://inch-ci.org/github/fixrb/defi.svg?branch=main)][inchpages]
6
6
  [![Documentation](https://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
7
7
 
8
8
  > Challenge library.
@@ -12,7 +12,7 @@
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'defi'
15
+ gem "defi"
16
16
  ```
17
17
 
18
18
  And then execute:
@@ -34,27 +34,20 @@ Defi.send(:*, 7).to(6).call # => 42
34
34
  Now, let's challenge "`foo`" with `boom` method:
35
35
 
36
36
  ```ruby
37
- Defi.send(:boom).to('foo').call # NoMethodError: undefined method `boom' for "foo":String
37
+ Defi.send(:boom).to("foo").call # NoMethodError: undefined method `boom' for "foo":String
38
38
  ```
39
39
 
40
40
  Let's challenge "`hello world`" with `gsub!` in isolation:
41
41
 
42
42
  ```ruby
43
- some_text = 'hello world'
44
- Defi.send(:gsub!, 'world', 'Alice').to!(some_text).call # => "hello Alice"
43
+ some_text = "hello world"
44
+ Defi.send(:gsub!, "world", "Alice").to!(some_text).call # => "hello Alice"
45
45
  some_text # => "hello world"
46
46
  ```
47
47
 
48
48
  ## Contact
49
49
 
50
- * Home page: https://github.com/fixrb/defi
51
- * Bugs/issues: https://github.com/fixrb/defi/issues
52
-
53
- ## Rubies
54
-
55
- * [MRI](https://www.ruby-lang.org/)
56
- * [Rubinius](https://rubinius.com/)
57
- * [JRuby](https://www.jruby.org/)
50
+ * Source code: https://github.com/fixrb/defi/issues
58
51
 
59
52
  ## Versioning
60
53
 
@@ -69,7 +62,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
69
62
  <p>
70
63
  This project is sponsored by:<br />
71
64
  <a href="https://sashite.com/"><img
72
- src="https://github.com/fixrb/defi/raw/master/img/sashite.png"
65
+ src="https://github.com/fixrb/defi/raw/main/img/sashite.png"
73
66
  alt="Sashite" /></a>
74
67
  </p>
75
68
 
data/lib/defi.rb CHANGED
@@ -19,4 +19,4 @@ module Defi
19
19
  end
20
20
  end
21
21
 
22
- require_relative File.join('defi', 'challenge')
22
+ require_relative File.join("defi", "challenge")
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aw'
3
+ require "aw"
4
4
 
5
5
  module Defi
6
6
  # This class contains a challenge to apply against an object.
@@ -18,25 +18,11 @@ module Defi
18
18
  @block = block
19
19
  end
20
20
 
21
- # @see https://twitter.com/kamipo/status/1213030647591137280
22
- if ::RUBY_VERSION > '2.7'
23
- # @param object [#object_id] The object to challenge.
24
- #
25
- # @return [Defi::Value] The actual value, to raise or to return.
26
- def to(object)
27
- Value.new { object.public_send(@method, *@args, **@opts, &@block) }
28
- end
29
- else
30
- # @param object [#object_id] The object to challenge.
31
- #
32
- # @return [Defi::Value] The actual value, to raise or to return.
33
- def to(object)
34
- if @opts.empty?
35
- Value.new { object.public_send(@method, *@args, &@block) }
36
- else
37
- Value.new { object.public_send(@method, *@args, **@opts, &@block) }
38
- end
39
- end
21
+ # @param object [#object_id] The object to challenge.
22
+ #
23
+ # @return [Defi::Value] The actual value, to raise or to return.
24
+ def to(object)
25
+ Value.new { object.public_send(@method, *@args, **@opts, &@block) }
40
26
  end
41
27
 
42
28
  # @param object [#object_id] The object to challenge in code isolation.
@@ -70,9 +56,9 @@ module Defi
70
56
 
71
57
  stringified_args = @args.inspect[1..-2]
72
58
  stringified_opts = @opts.inspect[1..-2]
73
- stringified_block = '<Proc>' unless @block.nil?
59
+ stringified_block = "<Proc>" unless @block.nil?
74
60
 
75
- string += '('
61
+ string += "("
76
62
 
77
63
  stringified_items = []
78
64
 
@@ -80,7 +66,7 @@ module Defi
80
66
  stringified_items << stringified_opts unless @opts.empty?
81
67
  stringified_items << stringified_block unless @block.nil?
82
68
 
83
- string + stringified_items.join(', ') + ')'
69
+ "#{string}#{stringified_items.join(', ')})"
84
70
  end
85
71
 
86
72
  # A string containing a human-readable representation of the challenge.
@@ -90,16 +76,16 @@ module Defi
90
76
  inspected_method = @method.inspect
91
77
  inspected_args = @args.inspect
92
78
  inspected_opts = @opts.inspect
93
- inspected_block = @block.nil? ? 'nil' : '<Proc>'
79
+ inspected_block = @block.nil? ? "nil" : "<Proc>"
94
80
 
95
- 'Defi(' \
81
+ "Defi(" \
96
82
  "method: #{inspected_method}, " \
97
- "args: #{ inspected_args }, " \
98
- "opts: #{ inspected_opts }, " \
99
- "block: #{ inspected_block }" \
100
- ')'
83
+ "args: #{inspected_args}, " \
84
+ "opts: #{inspected_opts}, " \
85
+ "block: #{inspected_block}" \
86
+ ")"
101
87
  end
102
88
  end
103
89
  end
104
90
 
105
- require_relative 'value'
91
+ require_relative "value"
data/lib/defi/value.rb CHANGED
@@ -48,7 +48,7 @@ module Defi
48
48
  #
49
49
  # @return [String] The string representation of the value.
50
50
  def to_s
51
- string = raised? ? 'raise' : 'return'
51
+ string = raised? ? "raise" : "return"
52
52
  "#{string} #{object}"
53
53
  end
54
54
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-09 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aw
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.10
19
+ version: 0.1.12
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.10
26
+ version: 0.1.12
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.1'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.1'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '13.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '13.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rubocop
56
+ name: rubocop-md
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.79'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.79'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-performance
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,34 +80,62 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-thread_safety
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: simplecov
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - "~>"
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
- version: '0.17'
117
+ version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - "~>"
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
- version: '0.17'
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: yard
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - "~>"
129
+ - - ">="
102
130
  - !ruby/object:Gem::Version
103
- version: '0.9'
131
+ version: '0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - "~>"
136
+ - - ">="
109
137
  - !ruby/object:Gem::Version
110
- version: '0.9'
138
+ version: '0'
111
139
  description: Challenge library.
112
140
  email: contact@cyril.email
113
141
  executables: []
@@ -131,14 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
159
  requirements:
132
160
  - - ">="
133
161
  - !ruby/object:Gem::Version
134
- version: '0'
162
+ version: 2.7.0
135
163
  required_rubygems_version: !ruby/object:Gem::Requirement
136
164
  requirements:
137
165
  - - ">="
138
166
  - !ruby/object:Gem::Version
139
167
  version: '0'
140
168
  requirements: []
141
- rubygems_version: 3.1.2
169
+ rubygems_version: 3.1.4
142
170
  signing_key:
143
171
  specification_version: 4
144
172
  summary: Challenge library.