Class: Merrol::Controller
- Inherits:
-
Object
- Object
- Merrol::Controller
- Defined in:
- lib/merrol/controllers/controller.rb
Direct Known Subclasses
EditController, FileController, HelpController, MainController, SearchController, ToolsController
Instance Method Summary collapse
-
#initialize(commands, views) ⇒ Controller
constructor
A new instance of Controller.
- #method_missing(meth, *args, &block) ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(commands, views) ⇒ Controller
Returns a new instance of Controller.
4 5 6 7 8 9 |
# File 'lib/merrol/controllers/controller.rb', line 4 def initialize commands, views @commands = commands @views = views @commands.register(self) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/merrol/controllers/controller.rb', line 11 def method_missing(meth, *args, &block) method = meth.to_s if method =~ /_view$/ view = @views[method.gsub(/_view$/, '').to_sym] view || super else super end end |
Instance Method Details
#name ⇒ Object
21 22 23 |
# File 'lib/merrol/controllers/controller.rb', line 21 def name self.class.to_s.demodulize.underscore.gsub(/_controller$/, '').to_sym end |