Sha256: 4caa240029018ca3865c14da598bfabd199d12a0a5487821715a8d1ae12c9e70

Contents?: true

Size: 306 Bytes

Versions: 8

Compression:

Stored size: 306 Bytes

Contents

module Kernel

  # Like returning but exectures the block
  # via instance_eval.
  #
  #   def foo
  #     with values = [] do
  #       self << 'bar'
  #       self << 'baz'
  #     end
  #   end
  #
  #   foo # => ['bar', 'baz']
  #
  def with(obj=self, &block)
    obj.instance_eval(&block)
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
facets-2.7.0 lib/core/facets/kernel/with.rb
facets-2.6.0 lib/core/facets/kernel/with.rb
facets-2.4.4 lib/core/facets/kernel/with.rb
facets-2.5.0 lib/core/facets/kernel/with.rb
facets-2.4.5 lib/core/facets/kernel/with.rb
facets-2.5.1 lib/core/facets/kernel/with.rb
facets-2.5.2 lib/core/facets/kernel/with.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/kernel/with.rb