Sha256: d30b0630a31ce1052256fd904f94ab1d3be620ea7673e0d038137eb9b3016edc
Contents?: true
Size: 302 Bytes
Versions: 1
Compression:
Stored size: 302 Bytes
Contents
module Librato class Template < Struct.new(:string, :vars) def generate self.string = string.gsub('%', '%%') vars.inject(string) do |string, (name, value)| string.gsub(value, "%{#{name}}") end end def render string % vars.symbolize_keys end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
librato-0.0.7 | lib/librato/template.rb |