Module: Sheets::Renderable
- Included in:
- Base
- Defined in:
- lib/sheets/renderable.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/sheets/renderable.rb', line 13 def method_missing(method_name, *args, &block) match = method_name.to_s.match(/\Ato_(.*)/i) format = match[1] unless match.nil? format.nil? || !self.class.renderable_formats.include?(format) ? super(method_name, args, block) : renderer(format).send(method_name) end |
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/sheets/renderable.rb', line 3 def self.included(base) base.extend(ClassMethods) end |