Class: Classifile::TargetFile
- Inherits:
-
Object
- Object
- Classifile::TargetFile
- Defined in:
- lib/classifile/target_file.rb
Overview
Class representing the target file
Instance Attribute Summary collapse
-
#atime ⇒ Object
Returns the value of attribute atime.
-
#basename ⇒ Object
Returns the value of attribute basename.
-
#ctime ⇒ Object
Returns the value of attribute ctime.
-
#dirname ⇒ Object
Returns the value of attribute dirname.
-
#extname ⇒ Object
Returns the value of attribute extname.
-
#full_path ⇒ Object
Returns the value of attribute full_path.
-
#pure_basename ⇒ Object
Returns the value of attribute pure_basename.
-
#size ⇒ Object
Returns the value of attribute size.
-
#to_path ⇒ Object
Returns the value of attribute to_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(full_path) ⇒ TargetFile
constructor
A new instance of TargetFile.
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
#atime ⇒ Object
Returns the value of attribute atime.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def atime @atime end |
#basename ⇒ Object
Returns the value of attribute basename.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def basename @basename end |
#ctime ⇒ Object
Returns the value of attribute ctime.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def ctime @ctime end |
#dirname ⇒ Object
Returns the value of attribute dirname.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def dirname @dirname end |
#extname ⇒ Object
Returns the value of attribute extname.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def extname @extname end |
#full_path ⇒ Object
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_basename ⇒ Object
Returns the value of attribute pure_basename.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def pure_basename @pure_basename end |
#size ⇒ Object
Returns the value of attribute size.
8 9 10 |
# File 'lib/classifile/target_file.rb', line 8 def size @size end |
#to_path ⇒ Object
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 |