Sha256: e94a54755c36028b7a54edc57c9b3f11b3c1673f1d2ff8dcc533c0914ae2c345

Contents?: true

Size: 305 Bytes

Versions: 4

Compression:

Stored size: 305 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

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.4.0 lib/facets/kernel/with.rb
facets-2.4.1 lib/facets/kernel/with.rb
facets-2.4.2 lib/core/facets/kernel/with.rb
facets-2.4.3 lib/core/facets/kernel/with.rb