Module: Kansuu::Util
- Defined in:
- lib/kansuu/util.rb
Instance Method Summary collapse
- #__define_func_from_method ⇒ Object
- #__define_funcs_from_method ⇒ Object
- #__module_functionize ⇒ Object
Instance Method Details
#__define_func_from_method ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/kansuu/util.rb', line 4 def __define_func_from_method -> name, method, arity, with_proc = false { define_method name, ( with_proc ? -> *a, p, o { o._(method).(*a, &p) } % arity : -> *a, o { o._(method).(*a) } % arity ) } end |
#__define_funcs_from_method ⇒ Object
14 15 16 |
# File 'lib/kansuu/util.rb', line 14 def __define_funcs_from_method -> hash { hash.each &-> k, v { __define_func_from_method.(k, *v) } } end |
#__module_functionize ⇒ Object
18 19 20 |
# File 'lib/kansuu/util.rb', line 18 def __module_functionize -> {instance_methods.map &_.module_function} end |