Module: Ncase
- Defined in:
- lib/ncase.rb,
lib/ncase/words.rb,
lib/ncase/version.rb
Overview
Contains convenience methods for one-off use.
Defined Under Namespace
Classes: Words
Constant Summary collapse
- VERSION =
"0.2.1"
Class Method Summary collapse
-
.method_missing(name, *args) ⇒ Object
Delegate <name> to Words#<name>_case if it’s defined.
- .respond_to_missing?(name) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Class Method Details
.method_missing(name, *args) ⇒ Object
Delegate <name> to Words#<name>_case if it’s defined.
11 12 13 14 15 16 17 |
# File 'lib/ncase.rb', line 11 def method_missing(name, *args) if (method = Words.public_instance_method("#{name}_case")) method.bind(Words.new(*args)).call else super end end |
.respond_to_missing?(name) ⇒ Boolean
19 20 21 |
# File 'lib/ncase.rb', line 19 def respond_to_missing?(name, *) Words.public_instance_method("#{name}_case") || super end |