Sha256: 24b8478ef61c2be49fddb025e5c293c0d5db915efa487fbe792c800542c070ed

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 Bytes

Contents

require 'facets/functor'

class String

  # Use fluent notation for making file directives.
  #
  # For instance, if we had a file 'foo.txt',
  #
  #    'foo.txt'.file.mtime
  #
  def file
    Functor.new(&method(:file_send).to_proc)
  end

  private

  def file_send(op, *a, &b)
    File.send(op, self, *a, &b)
  end

  ## TODO: When no longer needing to support 1.8.6 we can use:
  ##
  ## # Use fluent notation for making file directives.
  ## #
  ## #    'README.rdoc'.file.mtime
  ## #  
  ## def file
  ##   f = self
  ##   Functor.new do |op, *a, &b|
  ##     File.send(op, f, *a, &b)
  ##   end
  ## end

end

Version data entries

4 entries across 3 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/string/file.rb
facets-2.9.2 src/core/facets/string/file.rb
facets-2.9.2 lib/core/facets/string/file.rb
facets-2.9.1 lib/core/facets/string/file.rb