Sha256: 2af2beadddc2db6a1f7423d21b24cf10d7d62f8bf41f436d68ba266aa0083694

Contents?: true

Size: 264 Bytes

Versions: 11

Compression:

Stored size: 264 Bytes

Contents

if RUBY_VERSION < '1.9.2'
  class String
    old_format = instance_method(:%)

    define_method(:%) do |arg|
      if arg.is_a?(Hash)
        self.gsub(/%\{(.*?)\}/) { arg[$1.to_sym] }
      else
        old_format.bind(self).call(arg)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
socialcast-1.2.3 lib/ext/string_ext.rb
socialcast-1.2.2 lib/ext/string_ext.rb
socialcast-1.2.1.RC1 lib/ext/string_ext.rb
socialcast-1.2.0 lib/ext/string_ext.rb
socialcast-1.1.6 lib/ext/string_ext.rb
socialcast-1.1.5 lib/ext/string_ext.rb
socialcast-1.1.4 lib/ext/string_ext.rb
socialcast-1.1.3 lib/ext/string_ext.rb
socialcast-1.1.2 lib/ext/string_ext.rb
socialcast-1.1.1 lib/ext/string_ext.rb
socialcast-1.1.0 lib/ext/string_ext.rb