Class: Lcms::Engine::BasePresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/lcms/engine/base_presenter.rb

Direct Known Subclasses

ContentPresenter

Instance Method Summary collapse

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, options = {})
  class_name = self.class.to_s.underscore
  options[:raise] = true
  if key.starts_with?('.')
    I18n.t("#{class_name}.#{key}", options)
  else
    I18n.t(key, options)
  end
end