Sha256: c05186aaa48daf56190e096df06e4a7204e33f3a71285f174c4920a5a138aad3

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

module PageMeta
  class Translator
    attr_reader :scope, :naming, :options

    def initialize(scope, naming, options = {})
      @scope = scope
      @naming = naming
      @options = options
    end

    def to_s
      return "" if simple.blank?
      I18n.t("page_meta.#{scope}.base", value: simple, default: simple)
    end

    def simple
      I18n.t(
        "page_meta.#{scope}.#{naming.controller}.#{naming.action}",
        options.merge(default: "")
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page_meta-0.1.1 lib/page_meta/translator.rb
page_meta-0.1.0 lib/page_meta/translator.rb