Sha256: e72a654833a3aba5e19f1c586298bac434b198433b5d49f5a5e3cfbbae6f7534

Contents?: true

Size: 234 Bytes

Versions: 3

Compression:

Stored size: 234 Bytes

Contents

module AwesomeTranslations::ObjectExtensions
  def _(str, replaces = nil)
    str = str.to_s

    if replaces
      replaces.each do |key, val|
        str = str.gsub("%{#{key}}", val.to_s)
      end
    end

    return str
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awesome_translations-0.0.4 lib/awesome_translations/object_extensions.rb
awesome_translations-0.0.3 lib/awesome_translations/object_extensions.rb
awesome_translations-0.0.2 lib/awesome_translations/object_extensions.rb