Sha256: 5d2f88631435a22e34e9b8bc7769629a23cc4561e4076bebed999ddadc8b2c2d
Contents?: true
Size: 646 Bytes
Versions: 4
Compression:
Stored size: 646 Bytes
Contents
module Simply module Locals # Pass in a hash of local variables # which will be available to the template: # # @builder.locals = { :foo => 1, :bar => 2, :baz => 3} # @builder.ul do # li foo # li bar # li baz # end # # @builder.to_s #=> "<ul><li>1</li><li>2</li><li>3</li></ul>" def locals=(hash={ }) def metaclass(&block) meta = class << self; self; end meta.instance_eval(&block) end hash.each do |key, value| metaclass do define_method key do value end end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
smtlaissezfaire-simply-0.1.1 | lib/simply/locals.rb |
smtlaissezfaire-simply-0.2.1 | lib/simply/locals.rb |
simply-0.2.3 | lib/simply/locals.rb |
simply-0.1.3 | lib/simply/locals.rb |