Sha256: 9671f0685b3a19dd1d4e2aa3c6ebb4956aeb909631168f83cd1f0fbc1259f5b6

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module Ramaze
  module CoreExtensions
    # Extensions for Proc
    module Proc
      ##
      # Returns a hash of localvar/localvar-values from proc, useful for
      # template engines that do not accept bindings/proc and force passing
      # locals via hash
      #
      # Usage:
      #
      #     x = 42; p Proc.new.locals #=> {'x'=> 42}
      #
      def locals
        instance_eval('binding').locals
      end
    end # Proc
  end # CoreExtensions
end # Ramaze

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-2012.04.14 lib/ramaze/snippets/proc/locals.rb
ramaze-2012.03.07 lib/ramaze/snippets/proc/locals.rb
ramaze-2011.12.28 lib/ramaze/snippets/proc/locals.rb
ramaze-2011.10.23 lib/ramaze/snippets/proc/locals.rb