Sha256: 41015fdc57f949495e3736ee4f5edce15d9baa2bb1154da655825a79f4e1a3e5

Contents?: true

Size: 408 Bytes

Versions: 11

Compression:

Stored size: 408 Bytes

Contents

module Handlebars
  class Partials
    attr_accessor :partial_missing

    def initialize
      @partials = {}
    end
    
    def []=(name, value)
      @partials[name.to_s] = value
    end
    
    def [](name)
      if @partials.has_key?(name.to_s)
        return @partials[name.to_s]
      elsif @partial_missing
        return @partial_missing[name]
      else
        yield
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
handlebars-0.8.0 lib/handlebars/partials.rb
handlebars-0.7.0 lib/handlebars/partials.rb
handlebars-0.6.0 lib/handlebars/partials.rb
handlebars-0.5.0 lib/handlebars/partials.rb
handlebars-0.4.0 lib/handlebars/partials.rb
handlebars-0.3.2 lib/handlebars/partials.rb
handlebars-0.3.2beta4 lib/handlebars/partials.rb
handlebars-0.3.2beta3 lib/handlebars/partials.rb
handlebars-0.3.2beta2 lib/handlebars/partials.rb
handlebars-0.3.2beta1 lib/handlebars/partials.rb
handlebars-0.3.1 lib/handlebars/partials.rb