Class: FC::File
- Inherits:
-
Object
- Object
- FC::File
- Defined in:
- lib/fc.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #ext ⇒ Object
-
#initialize(filepath) ⇒ File
constructor
A new instance of File.
- #name ⇒ Object
Constructor Details
#initialize(filepath) ⇒ File
Returns a new instance of File.
14 15 16 17 18 |
# File 'lib/fc.rb', line 14 def initialize(filepath) raise Error::FileDoesNotExist unless ::File.file?(filepath) @path = filepath end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
12 13 14 |
# File 'lib/fc.rb', line 12 def path @path end |
Instance Method Details
#ext ⇒ Object
24 25 26 |
# File 'lib/fc.rb', line 24 def ext @ext ||= ::File.extname(path).delete!('.') end |
#name ⇒ Object
20 21 22 |
# File 'lib/fc.rb', line 20 def name @name ||= ::File.basename(path) end |