Class: Crumbs::Dsl::Controller
- Inherits:
-
Object
- Object
- Crumbs::Dsl::Controller
- Defined in:
- lib/crumbs/dsl/controller.rb
Instance Method Summary collapse
- #crumb(action, name = nil, &block) ⇒ Object
-
#initialize(prefix, &block) ⇒ Controller
constructor
A new instance of Controller.
- #t(key) ⇒ Object
Constructor Details
#initialize(prefix, &block) ⇒ Controller
Returns a new instance of Controller.
5 6 7 8 |
# File 'lib/crumbs/dsl/controller.rb', line 5 def initialize(prefix, &block) @prefix = prefix instance_eval(&block) end |
Instance Method Details
#crumb(action, name = nil, &block) ⇒ Object
10 11 12 |
# File 'lib/crumbs/dsl/controller.rb', line 10 def crumb(action, name=nil, &block) Crumbs.definitions.add "#{@prefix}##{action}", (block_given? ? block : name) end |
#t(key) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/crumbs/dsl/controller.rb', line 14 def t(key) if key.starts_with?('.') key.prepend 'crumbs' end I18n.t key end |