Class: Glueckskeks::Substitutor
- Inherits:
-
Object
- Object
- Glueckskeks::Substitutor
- Defined in:
- lib/glueckskeks/substitutor.rb
Class Method Summary collapse
Class Method Details
.replace(str, corpus) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/glueckskeks/substitutor.rb', line 3 def self.replace(str, corpus) /.*<(?<type>[^>]*)>.*/ =~ str if type replace_with = corpus[type].sample str.gsub!("\<#{type}\>", replace_with) end str end |