Sha256: 094b111744117b1fcafd346a75f6c8637dabe254e47ba396fc1d6a26bc201f5f

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

module SoMeta
  module Helper
    def so_meta(name, scope = nil)
      interpolation_data = instance_variable_get("@so_meta_#{name}_interpolation") || {}

      controller_name = controller_path.gsub(/\//, "_")

      if scope.present?
        t("so_meta.#{controller_name}.#{action_name}.#{scope}.#{name}",
          default: t("so_meta.#{controller_name}.#{action_name}.#{name}", interpolation_data.merge(default: t("so_meta.defaults.#{name}")))
        )
      end
    end

    def so_meta_interpolation(name, hash)
      instance_variable_set("@so_meta_#{name}_interpolation", hash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
so_meta-0.4 lib/so_meta/helper.rb