Class: Lcms::Engine::BasePresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Lcms::Engine::BasePresenter
- Defined in:
- app/presenters/lcms/engine/base_presenter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(obj, opts = {}) ⇒ BasePresenter
constructor
A new instance of BasePresenter.
- #t(key, options = {}) ⇒ Object
Constructor Details
#initialize(obj, opts = {}) ⇒ BasePresenter
Returns a new instance of BasePresenter.
6 7 8 9 10 11 |
# File 'app/presenters/lcms/engine/base_presenter.rb', line 6 def initialize(obj, opts = {}) super(obj) opts.each_pair do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Method Details
#t(key, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/presenters/lcms/engine/base_presenter.rb', line 13 def t(key, = {}) class_name = self.class.to_s.underscore [:raise] = true if key.starts_with?('.') I18n.t("#{class_name}.#{key}", ) else I18n.t(key, ) end end |