Class: String
Instance Method Summary collapse
-
#tokenize(hash = {}) ⇒ Object
Replace
hash
keys with associated values. -
#tokenize!(hash = {}) ⇒ Object
Replace
hash
keys with associated values.
Instance Method Details
#tokenize(hash = {}) ⇒ Object
Replace hash
keys with associated values.
15 16 17 |
# File 'lib/commander/core_ext/string.rb', line 15 def tokenize hash = {} self.dup.tokenize! hash end |
#tokenize!(hash = {}) ⇒ Object
Replace hash
keys with associated values.
7 8 9 10 |
# File 'lib/commander/core_ext/string.rb', line 7 def tokenize! hash = {} hash.each { |key, value| gsub! /:#{key}/, value.to_s } self end |