Module: Undies::Element::CSSProxy
Overview
Utility Classes
Constant Summary collapse
- ID_METH_REGEX =
/^([^_].+)!$/
- CLASS_METH_REGEX =
/^([^_].+)$/
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/undies/element.rb', line 47 def method_missing(meth, *args, &block) if meth.to_s =~ ID_METH_REGEX @attrs[:id] = $1 proxy(args, block) elsif meth.to_s =~ CLASS_METH_REGEX @attrs[:class] = [@attrs[:class], $1].compact.join(' ') proxy(args, block) else super end end |
Instance Method Details
#respond_to?(*args) ⇒ Boolean
59 60 61 62 63 64 65 |
# File 'lib/undies/element.rb', line 59 def respond_to?(*args) if args.first.to_s =~ ID_METH_REGEX || args.first.to_s =~ CLASS_METH_REGEX true else super end end |