function_module 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -1
- data/lib/function_module.rb +10 -0
- data/lib/function_module/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6ce3623e2abb1f2d01ad7a52b17f68d45788794
|
4
|
+
data.tar.gz: 1c58376affa4de866a56f54a03e6906956058191
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d073e3726ed0aaf40620220f9b0667cc218c8910b659a62f02020e2dde01f9b88ee52f2076402048bd055668990ea0c81998050a11fadc994ff0bdcb16bf34
|
7
|
+
data.tar.gz: d774e6ac00ed33fb3b7e22b8634f5389dad360edefc24a97a7364eefc3509598b1a3135fdb83e840f137a85def2a5fd308f8a23c1b1f17bed9cbb0dca9d65e0d
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -32,12 +32,15 @@ Note:
|
|
32
32
|
* It doesn't check method definition; even if private instance method and public singleton method are different, it is counted as module function.
|
33
33
|
* methods in `Module` itself are excluded (`Module.new.module_functions` return empty `Aryay`)
|
34
34
|
|
35
|
-
### `Module#include_module_functions` (private)
|
35
|
+
### `Module#include_module_functions(mod)` (private)
|
36
36
|
Using `include_module_functions another_mod` in some module,
|
37
37
|
|
38
38
|
* include `another_mod` as usual.
|
39
39
|
* extend `another_mod` and make module functions public (usable for singleton methods)
|
40
40
|
|
41
|
+
### `Module#alias_module_function(new_name, old_name)` (private)
|
42
|
+
Make alias of module functions. In `alias`/`alias_method`, only instance method is aliased.
|
43
|
+
|
41
44
|
## Development
|
42
45
|
|
43
46
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/function_module.rb
CHANGED
@@ -21,4 +21,14 @@ class Module # :nodoc:
|
|
21
21
|
extend mod
|
22
22
|
singleton_class.__send__ :public, *mod.module_functions
|
23
23
|
end
|
24
|
+
|
25
|
+
# make alias for module function.
|
26
|
+
# @param new_name new method name (in Symbol/String)
|
27
|
+
# @param old_name old method name (in Symbol/String)
|
28
|
+
def alias_module_function(new_name, old_name)
|
29
|
+
# alias private method
|
30
|
+
alias_method new_name, old_name
|
31
|
+
# make new method to module function
|
32
|
+
module_function new_name
|
33
|
+
end
|
24
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: function_module
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jkr2255
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
64
|
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- Gemfile
|
66
67
|
- LICENSE.txt
|
67
68
|
- README.md
|