Sha256: e5c8d00a93b3ee186ed0194d866db27cc3b0ec15059218a278fe60949f94362b
Contents?: true
Size: 904 Bytes
Versions: 3
Compression:
Stored size: 904 Bytes
Contents
#! /usr/bin/ruby =begin string.rb - Extension for String. Copyright (C) 2005,2006 Masao Mutoh You may redistribute it and/or modify it under the same license terms as Ruby. =end # Extension for String class. This feature is included in Ruby 1.9 or later. if RUBY_VERSION < "1.9.0" class String alias :_old_format_m :% # :nodoc: # call-seq: # %(hash) # # Default: "%s, %s" % ["Masao", "Mutoh"] # Extended: "%{firstname}, %{lastname}" % {:firstname=>"Masao",:lastname=>"Mutoh"} # # This is the recommanded way for Ruby-GetText # because the translators can understand the meanings of the msgids easily. def %(args) if args.kind_of?(Hash) ret = dup args.each {|key, value| ret.gsub!(/\%\{#{key}\}/, value.to_s)} ret else ret = gsub(/%\{/, '%%{') ret._old_format_m(args) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grosser-fast_gettext-0.2.1 | vendor/string.rb |
grosser-fast_gettext-0.2.2 | vendor/string.rb |
grosser-fast_gettext-0.2.3 | vendor/string.rb |