active_method 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +21 -0
- data/lib/active_method/version.rb +1 -1
- data/lib/active_method.rb +5 -1
- metadata +2 -3
- data/Gemfile.lock +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09981bf259603ed5a3702d558f61812780801c59af7dc1f61e0a8a4d9785e211'
|
4
|
+
data.tar.gz: 6ac6cc4ab0f822592bd355f2d57cb9c7bddfd5d743685e2e20115da8a6f6eae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44df9e385113755724745f2fc0a022b71d44611b7443f627dc04a78dc3b26d529259315ee8eaada7172fc6791a2eab22b0f2ee9c368b1c933d1c25c2314ee1b1
|
7
|
+
data.tar.gz: eb4cb181d3112ae398aaae750a7bf431f71265d21f0b6084fc804bd4368e78bb07fbabc14bd756a00f1e840299e1d2e9ea5521cb03591b4e0ba781043c88b9a2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -87,6 +87,27 @@ Bar.call(1, 3, c: 4, d: 5)
|
|
87
87
|
# => buzz
|
88
88
|
```
|
89
89
|
|
90
|
+
### Work on module
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
class Hi < ActiveMethod::Base
|
94
|
+
argument :name
|
95
|
+
|
96
|
+
def call
|
97
|
+
"Hi, #{name}"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
module Say
|
102
|
+
include ActiveMethod
|
103
|
+
|
104
|
+
active_method :hi, module_function: true
|
105
|
+
end
|
106
|
+
|
107
|
+
Say.hi('John')
|
108
|
+
# => "Hi, John"
|
109
|
+
```
|
110
|
+
|
90
111
|
## Development
|
91
112
|
|
92
113
|
```bash
|
data/lib/active_method.rb
CHANGED
@@ -12,12 +12,16 @@ module ActiveMethod
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module ClassMethods
|
15
|
-
def active_method(name, method_class = nil)
|
15
|
+
def active_method(name, method_class = nil, **options)
|
16
16
|
method_class ||= Util.constantize self, Util.camel_case(name)
|
17
17
|
|
18
18
|
define_method name do |*args|
|
19
19
|
method_class[self].call(*args)
|
20
20
|
end
|
21
|
+
|
22
|
+
if options[:module_function]
|
23
|
+
module_function name
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hopper Gee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Refactor your obscure method to a method object
|
14
14
|
email:
|
@@ -20,7 +20,6 @@ files:
|
|
20
20
|
- CHANGELOG.md
|
21
21
|
- CODE_OF_CONDUCT.md
|
22
22
|
- Gemfile
|
23
|
-
- Gemfile.lock
|
24
23
|
- LICENSE.txt
|
25
24
|
- README.md
|
26
25
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_method (0.1.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
concurrent-ruby (1.1.10)
|
10
|
-
debug (1.6.2)
|
11
|
-
irb (>= 1.3.6)
|
12
|
-
reline (>= 0.3.1)
|
13
|
-
docile (1.4.0)
|
14
|
-
io-console (0.5.11)
|
15
|
-
irb (1.4.1)
|
16
|
-
reline (>= 0.3.0)
|
17
|
-
matrixeval (0.4.3)
|
18
|
-
concurrent-ruby
|
19
|
-
rainbow (~> 3.1)
|
20
|
-
terminal-table
|
21
|
-
matrixeval-ruby (0.4.0)
|
22
|
-
matrixeval (~> 0.4.2)
|
23
|
-
minitest (5.16.2)
|
24
|
-
rainbow (3.1.1)
|
25
|
-
rake (13.0.6)
|
26
|
-
reline (0.3.1)
|
27
|
-
io-console (~> 0.5)
|
28
|
-
simplecov (0.21.2)
|
29
|
-
docile (~> 1.1)
|
30
|
-
simplecov-html (~> 0.11)
|
31
|
-
simplecov_json_formatter (~> 0.1)
|
32
|
-
simplecov-html (0.12.3)
|
33
|
-
simplecov_json_formatter (0.1.4)
|
34
|
-
terminal-table (3.0.2)
|
35
|
-
unicode-display_width (>= 1.1.1, < 3)
|
36
|
-
unicode-display_width (2.2.0)
|
37
|
-
|
38
|
-
PLATFORMS
|
39
|
-
arm64-darwin-21
|
40
|
-
|
41
|
-
DEPENDENCIES
|
42
|
-
active_method!
|
43
|
-
debug
|
44
|
-
matrixeval-ruby
|
45
|
-
minitest (~> 5.0)
|
46
|
-
rake (~> 13.0)
|
47
|
-
simplecov
|
48
|
-
|
49
|
-
BUNDLED WITH
|
50
|
-
2.3.12
|