Class: Classifile::TargetFile

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

Overview

Class representing the target file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_path) ⇒ TargetFile

Returns a new instance of TargetFile.



10
11
12
13
14
15
16
17
# File 'lib/classifile/target_file.rb', line 10

def initialize(full_path)
  path_name = Pathname.new(full_path)
  @full_path = full_path
  @dirname = dirname
  @basename = path_name.basename(full_path).to_s
  @pure_basename = path_name.basename(full_path).to_s.split(".")[0]
  @extname = path_name.extname
end

Instance Attribute Details

#atimeObject

Returns the value of attribute atime.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def atime
  @atime
end

#basenameObject

Returns the value of attribute basename.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def basename
  @basename
end

#ctimeObject

Returns the value of attribute ctime.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def ctime
  @ctime
end

#dirnameObject

Returns the value of attribute dirname.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def dirname
  @dirname
end

#extnameObject

Returns the value of attribute extname.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def extname
  @extname
end

#full_pathObject

Returns the value of attribute full_path.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def full_path
  @full_path
end

#pure_basenameObject

Returns the value of attribute pure_basename.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def pure_basename
  @pure_basename
end

#sizeObject

Returns the value of attribute size.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def size
  @size
end

#to_pathObject

Returns the value of attribute to_path.



8
9
10
# File 'lib/classifile/target_file.rb', line 8

def to_path
  @to_path
end

Class Method Details

.build_by_file(full_path) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/classifile/target_file.rb', line 19

def self.build_by_file(full_path)
  fs = File.stat(full_path)
  tf = TargetFile.new(full_path)
  tf.atime = fs.atime
  tf.ctime = fs.ctime
  tf.size = fs.size
  tf
end