Sha256: 43e9d83cfec4fbec461bdc61964180b2c699bbee80c657b5de9a965dfd94e431

Contents?: true

Size: 401 Bytes

Versions: 44

Compression:

Stored size: 401 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
  end
end

Version data entries

44 entries across 44 versions & 5 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/snippets/proc/locals.rb
Pistos-ramaze-2008.12 lib/ramaze/snippets/proc/locals.rb
Pistos-ramaze-2009.01 lib/ramaze/snippets/proc/locals.rb
Pistos-ramaze-2009.02 lib/ramaze/snippets/proc/locals.rb
Pistos-ramaze-2009.04.08 lib/ramaze/snippets/proc/locals.rb
Pistos-ramaze-2009.06.12 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2008.09 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2008.10 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2008.12 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.01 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.04.01 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.04.08 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.04.18 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.04.22 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.04 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.05.08 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.05 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.06.04 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.06.12 lib/ramaze/snippets/proc/locals.rb
manveru-ramaze-2009.06 lib/ramaze/snippets/proc/locals.rb