Sha256: eb0dc68f77fb0d9432b096d8af842f51678e4db8a8632ee99900561f23ca1b08

Contents?: true

Size: 546 Bytes

Versions: 16

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module Lcms
  module Engine
    class BasePresenter < SimpleDelegator
      def initialize(obj, opts = {})
        super(obj)
        opts.each_pair do |key, value|
          instance_variable_set("@#{key}", value)
        end
      end

      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
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.5.4 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.5.3 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.5.2 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.5.1 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.5.0 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.4.2 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.4.1 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.4.0 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.3.1 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.1.4 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.3.0 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.1.3 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.2.0 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.1.2 app/presenters/lcms/engine/base_presenter.rb
lcms-engine-0.1.0 app/presenters/lcms/engine/base_presenter.rb