Sha256: 6a179494645d7042dd217bafcc2516c3aba48252efca51926d1e37d1dd8ec511
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 Bytes
Contents
class Musterb::Musterbifier def initialize(template) @template = template end def to_erb @template.gsub(/\{\{(\{?[^\}]*\}?)\}\}/) do |match| match = $1 case match[0] when '#' "<% musterb.block '#{match[1..-1].strip}' do %>" when '^' "<% musterb.block_unless '#{match[1..-1].strip}' do %>" when "/" "<% end %>" when '{' "<%= musterb['#{match[1..-2].strip}'] %>" when '&' "<%= musterb['#{match[1..-1].strip}'] %>" when '!' "" else "<%== musterb['#{match.strip}'] %>" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
musterb-0.0.3 | lib/musterb/musterbifier.rb |
musterb-0.0.2 | lib/musterb/musterbifier.rb |