Method: String#mutate
- Defined in:
- lib/funcml-core/patch/string.rb
#mutate(mutations) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/funcml-core/patch/string.rb', line 7 def mutate(mutations) if self.start_with?('$') return Time.now.to_s if self.eql?('$now') return SecureRandom.uuid if self.eql?('$uuidv4') mutations.dig_from_str(self.gsub('$', ''), mutations).then do |value| raise MutationException, "`#{self}` not found in mutations, available mutations: #{mutations.to_s}" if value.nil? return value.mutate(mutations) end end self end |