Class: FC::File

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/fc.rb', line 12

def path
  @path
end

Instance Method Details

#extObject



24
25
26
# File 'lib/fc.rb', line 24

def ext
  @ext ||= ::File.extname(path).delete!('.')
end

#nameObject



20
21
22
# File 'lib/fc.rb', line 20

def name
  @name ||= ::File.basename(path)
end