Class: FilePath

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

Constant Summary collapse

@@count =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ FilePath

Returns a new instance of FilePath.



4
5
6
7
# File 'lib/filepath.rb', line 4

def initialize filepath 
  @id = get_id
  @filepath = filepath
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



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

def filepath
  @filepath
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

#get_idObject



9
10
11
12
# File 'lib/filepath.rb', line 9

def get_id
  @id = @@count
  @@count += 1
end

#to_sObject



14
15
16
17
18
# File 'lib/filepath.rb', line 14

def to_s
  str = ""
  str << "#{@id}. "
  str << "#{@filepath}".rjust(5) + ": "
end