Sha256: e06a4a5b37230649495b5fa970eaa99118f302b8c86329fb97627e4354d11102

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

module FunWith
  module Files
    module RootPathExtensions
      def root( *args, &block )
        if args.length > 0
          args.unshift( @root_path )
          FilePath.new( *args, &block )
        else
          FilePath.new( @root_path, &block )
        end
      end
      
      def set_root_path( path )
        @root_path = FunWith::Files::FilePath.new( path )
      end
    end

    class RootPath
      def self.rootify( target, path )
        if target.respond_to?(:root)
          warn( "#{target} already responds to :root, skipping installation" )
          return nil
        end
        
        target.extend( RootPathExtensions )
        target.set_root_path( FilePath.new( path ) )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fun_with_files-0.0.18 ./lib/fun_with/files/root_path.rb