Sha256: 9a80cafb584e33f99378ad0c8a4a352200b5cf86db18250eaaa22b79516f70e9

Contents?: true

Size: 708 Bytes

Versions: 6

Compression:

Stored size: 708 Bytes

Contents

module FunWith
  module Files
    module RootPathExtensions
      def root( *args )
        if args.length > 0
          args.unshift( @root_path )
          FilePath.new( *args )
        else
          FilePath.new( @root_path )
        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

6 entries across 6 versions & 1 rubygems

Version Path
fun_with_files-0.0.15 ./lib/fun_with/files/root_path.rb
fun_with_files-0.0.14 ./lib/fun_with/files/root_path.rb
fun_with_files-0.0.13 ./lib/fun_with/files/root_path.rb
fun_with_files-0.0.12 ./lib/fun_with/files/root_path.rb
fun_with_files-0.0.9 ./lib/fun_with/files/root_path.rb
fun_with_files-0.0.8 ./lib/fun_with/files/root_path.rb