Sha256: 8886019bb9e45f5b783f35107356e350f5d9c4928309e510779b04c916b95dbc

Contents?: true

Size: 305 Bytes

Versions: 15

Compression:

Stored size: 305 Bytes

Contents

module Kernel

  # Like returning but exectues 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

15 entries across 14 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/kernel/with.rb
facets-3.1.0 lib/core/facets/kernel/with.rb
facets-3.0.0 lib/core/facets/kernel/with.rb
facets-2.9.3 lib/core/facets/kernel/with.rb
facets-2.9.2 lib/core/facets/kernel/with.rb
facets-2.9.2 src/core/facets/kernel/with.rb
facets-2.9.1 lib/core/facets/kernel/with.rb
facets-2.9.0 lib/core/facets/kernel/with.rb
facets-2.9.0.pre.2 lib/core/facets/kernel/with.rb
facets-2.9.0.pre.1 lib/core/facets/kernel/with.rb
facets-2.8.4 lib/core/facets/kernel/with.rb
facets-2.8.3 lib/core/facets/kernel/with.rb
facets-2.8.2 lib/core/facets/kernel/with.rb
facets-2.8.1 lib/core/facets/kernel/with.rb
facets-2.8.0 lib/core/facets/kernel/with.rb