Sha256: b83388de6cc417656d8a452f0a82bb9a0f8db85710e92e9f2e95b8d0351f65ad
Contents?: true
Size: 558 Bytes
Versions: 3
Compression:
Stored size: 558 Bytes
Contents
module Thunderer module Parser class << self def interpolate_channel channel, object channel.gsub(/:\w*\b/, interpolation_hash(channel, object)) end private def interpolation_hash channel, object {}.tap do |result| channel.scan(/:\w*\b/).map do |interpolation_key| object_method = interpolation_key.gsub(':', '') replaced_string = object.send(object_method).to_s result[interpolation_key] = replaced_string end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
thunderer-1.0.0 | lib/thunderer/parser.rb |
thunderer-0.9.1 | lib/thunderer/parser.rb |
thunderer-0.9.0 | lib/thunderer/parser.rb |