Module: Frubby::MethodMissing
- Defined in:
- lib/frubby/method_missing.rb
Constant Summary collapse
- EXCLUDED_METHODS =
i[ to_ary to_io to_hash to_str ]
- KERNEL_METHODS =
Kernel.methods.delete_if {|m| m.match /^[A-Z]/}
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/frubby/method_missing.rb', line 13 def method_missing(method_sym, *args, &block) return super if EXCLUDED_METHODS.include? method_sym _methods = KERNEL_METHODS + methods _method = FuzzyMatch.new(_methods).find(method_sym.to_s) warn "[frubby] method_missing: #{method_sym} -> #{_method}" if $DEBUG _method.is_a?(Symbol) ? send(_method.to_sym, *args, &block) : super end |