spaced 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -11
- data/README.md +2 -2
- data/fixtures/user.rb +0 -9
- data/lib/spaced/version.rb +1 -1
- data/lib/spaced.rb +1 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5ef69eb8f535a9dc505eaeecae109a756337df1a64d602bc0d9ede0f06714eb
|
4
|
+
data.tar.gz: a8731824808507cadc9a1362a004870919ab5e51be233439fe3fe4d77aeb1a89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfdc46fedd7c789836c16849e9fc58372f765f1d5e78c60640ca3d8c0b24b2da2a3fc7080fc0ce0a060f3826d9e2e46688781c53ce7120836cb24595eab6436d
|
7
|
+
data.tar.gz: ffd8dcd6d1214381a0aecee9df96eeb65ffd099b216d19118ea0b1ef3e5576020f54995bdc317e75704a24871209cc7ed60cc154b7598d2d2ba4fcc366d0deed
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spaced (0.
|
4
|
+
spaced (0.8.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
|
-
json (2.
|
11
|
-
language_server-protocol (3.17.0.
|
10
|
+
json (2.10.1)
|
11
|
+
language_server-protocol (3.17.0.4)
|
12
|
+
lint_roller (1.1.0)
|
12
13
|
parallel (1.26.3)
|
13
|
-
parser (3.3.
|
14
|
+
parser (3.3.7.1)
|
14
15
|
ast (~> 2.4.1)
|
15
16
|
racc
|
16
17
|
racc (1.8.1)
|
17
18
|
rainbow (3.1.1)
|
18
19
|
regexp_parser (2.10.0)
|
19
|
-
rubocop (1.
|
20
|
+
rubocop (1.72.1)
|
20
21
|
json (~> 2.3)
|
21
|
-
language_server-protocol (
|
22
|
+
language_server-protocol (~> 3.17.0.2)
|
23
|
+
lint_roller (~> 1.1.0)
|
22
24
|
parallel (~> 1.10)
|
23
25
|
parser (>= 3.3.0.2)
|
24
26
|
rainbow (>= 2.2.2, < 4.0)
|
25
27
|
regexp_parser (>= 2.9.3, < 3.0)
|
26
|
-
rubocop-ast (>= 1.
|
28
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
27
29
|
ruby-progressbar (~> 1.7)
|
28
30
|
unicode-display_width (>= 2.4.0, < 4.0)
|
29
|
-
rubocop-ast (1.
|
31
|
+
rubocop-ast (1.38.0)
|
30
32
|
parser (>= 3.3.1.0)
|
31
|
-
rubocop-minitest (0.
|
32
|
-
|
33
|
-
rubocop
|
33
|
+
rubocop-minitest (0.37.1)
|
34
|
+
lint_roller (~> 1.1)
|
35
|
+
rubocop (>= 1.72.1, < 2.0)
|
36
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
34
37
|
ruby-progressbar (1.13.0)
|
35
38
|
sus (0.32.0)
|
36
39
|
unicode-display_width (3.1.4)
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ In the example above, `namespace` creates and initializes a new class `Twitter`
|
|
38
38
|
|
39
39
|
## Magic bang and predicate methods
|
40
40
|
|
41
|
-
If you define a `#_!`
|
41
|
+
If you define a `#_!` method in your namespaced class, you can then conveniently call that with a bang method:
|
42
42
|
|
43
43
|
```ruby
|
44
44
|
class User
|
@@ -64,7 +64,7 @@ namespace :tweet do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
user = User.new
|
67
|
-
user.tweet? # Will call the `#
|
67
|
+
user.tweet? # Will call the `#_?` method.
|
68
68
|
```
|
69
69
|
|
70
70
|
Both bang and predicate methods can be defined using identically named methods:
|
data/fixtures/user.rb
CHANGED
data/lib/spaced/version.rb
CHANGED
data/lib/spaced.rb
CHANGED
@@ -38,7 +38,7 @@ module Spaced
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# Define the bang and predicate methods.
|
41
|
-
methods = klass.
|
41
|
+
methods = klass.public_instance_methods
|
42
42
|
|
43
43
|
if methods.include?(:_!)
|
44
44
|
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
@@ -48,10 +48,6 @@ module Spaced
|
|
48
48
|
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
49
49
|
def #{name}!(...); #{name}.#{name}!(...); end # def user!; user.user!; end
|
50
50
|
RUBY
|
51
|
-
elsif methods.include?(:call) # DEPRECATED
|
52
|
-
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
53
|
-
def #{name}!(...); #{name}.call(...); end # def user!(...); user.call(...); end
|
54
|
-
RUBY
|
55
51
|
else
|
56
52
|
define_method :"#{name}!" do
|
57
53
|
raise NoMethodError,
|
@@ -67,10 +63,6 @@ module Spaced
|
|
67
63
|
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
68
64
|
def #{name}?(...); #{name}.#{name}?(...); end # def user?; user.user?; end
|
69
65
|
RUBY
|
70
|
-
elsif methods.include?(:predicate) # DEPRECATED
|
71
|
-
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
72
|
-
def #{name}?(...); #{name}.predicate(...); end # def user?; user.predicate; end
|
73
|
-
RUBY
|
74
66
|
else
|
75
67
|
define_method :"#{name}?" do
|
76
68
|
raise NoMethodError,
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
email:
|
13
13
|
- joel@developwithstyle.com
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.6.
|
52
|
+
rubygems_version: 3.6.3
|
53
53
|
specification_version: 4
|
54
54
|
summary: Super simple and convenient way to isolate and namespace a collection of
|
55
55
|
related methods
|