Sha256: 17dea4bb14f3e265767af945f96113ae872833cf2850ddc2bfe72cb2a97704b1

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

#require 'pathname'

module Folio

  class Path

    def initialize(path)
      if File.exist?(path)
        @delegate = Pathname.new(path, self)
      else
        @delegate = FileObject[path]
      end
    end

    def replace(file_object)
      @delegate = file_object
    end

    def method_missing(s, *a, &b)
      @delegate.__send__(s, *a, &b)
    end
  end


  class Pathname

    def initialize(path, delegator)

    end

    def cd
      delegator.replace(Directory.new(to_s))
      delegator.cd()
    end

  end

end




#module Kernel
#  def path(name)
#    Folio::Path.new(name)
#  end
#end

#$path = lambda{ |path| Folio::Path.new(path) }

#class String
#  def to_path
#    Folio::Path.new(self)
#  end
#end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
folio-0.4.0 lib/folio/path.rb