Sha256: 39cfa2652d2f2314579858ea20e2e7e288e0a6fe3c0174602552ce15b07b23be

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

module Rcurse
    @helpers = Hash.new

    def self.add_helper helper
        @helpers[helper.name] = helper
    end

    def self.helpers
        @helpers
    end

    def self.render filename
        file_contents = File.read filename
        file_contents.gsub /{{([^ ]+) *(.+)?}}/ do |s|
            name = $1
            args = $2.split(" ") if $2
            if @helpers[name] then
                @helpers[name].callback.call(args)
            end
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rcurse-0.1.0 lib/rcurse/engine.rb