Class: FilePath
- Inherits:
-
Object
- Object
- FilePath
- Defined in:
- lib/filepath.rb
Constant Summary collapse
- @@count =
0
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #get_id ⇒ Object
-
#initialize(filepath) ⇒ FilePath
constructor
A new instance of FilePath.
- #to_s ⇒ Object
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
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
3 4 5 |
# File 'lib/filepath.rb', line 3 def filepath @filepath end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/filepath.rb', line 3 def id @id end |
Instance Method Details
#get_id ⇒ Object
9 10 11 12 |
# File 'lib/filepath.rb', line 9 def get_id @id = @@count @@count += 1 end |
#to_s ⇒ Object
14 15 16 17 18 |
# File 'lib/filepath.rb', line 14 def to_s str = "" str << "#{@id}. " str << "#{@filepath}".rjust(5) + ": " end |