Class: AndParcel::FileRef

Inherits:
Object
  • Object
show all
Defined in:
lib/andparcel/fileref.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, dir = nil) ⇒ FileRef

Returns a new instance of FileRef.



15
16
17
18
19
20
# File 'lib/andparcel/fileref.rb', line 15

def initialize(name, dir=nil)
	@local=name
	@dir=dir
	@relative=@local[dir.size, 10000] if @local[0, dir.size]==dir
	@relative=@local if !@relative
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



3
4
5
# File 'lib/andparcel/fileref.rb', line 3

def dir
  @dir
end

#localObject (readonly)

Returns the value of attribute local.



3
4
5
# File 'lib/andparcel/fileref.rb', line 3

def local
  @local
end

#relativeObject (readonly)

Returns the value of attribute relative.



3
4
5
# File 'lib/andparcel/fileref.rb', line 3

def relative
  @relative
end

Class Method Details

.[](base) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/andparcel/fileref.rb', line 5

def self.[](base)
	files=[]
	
	if File.exists?(base)
		files += Dir[File.join(base, '**', '*')].collect {|x| FileRef.new(x, base)}
	end

	files			
end