Class: Entangler::EntangledFile
- Inherits:
-
Object
- Object
- Entangler::EntangledFile
- Defined in:
- lib/entangler/entangled_file.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#desired_modtime ⇒ Object
Returns the value of attribute desired_modtime.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #file_exists? ⇒ Boolean
- #full_path ⇒ Object
-
#initialize(action, rel_path) ⇒ EntangledFile
constructor
A new instance of EntangledFile.
- #process ⇒ Object
Constructor Details
#initialize(action, rel_path) ⇒ EntangledFile
Returns a new instance of EntangledFile.
10 11 12 13 14 15 |
# File 'lib/entangler/entangled_file.rb', line 10 def initialize(action, rel_path) @action = action @path = rel_path @desired_modtime = Time.now.to_i @contents = nil end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
7 8 9 |
# File 'lib/entangler/entangled_file.rb', line 7 def action @action end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
8 9 10 |
# File 'lib/entangler/entangled_file.rb', line 8 def contents @contents end |
#desired_modtime ⇒ Object
Returns the value of attribute desired_modtime.
7 8 9 |
# File 'lib/entangler/entangled_file.rb', line 7 def desired_modtime @desired_modtime end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/entangler/entangled_file.rb', line 8 def path @path end |
Instance Method Details
#file_exists? ⇒ Boolean
21 22 23 |
# File 'lib/entangler/entangled_file.rb', line 21 def file_exists? File.exist?(full_path) end |
#full_path ⇒ Object
17 18 19 |
# File 'lib/entangler/entangled_file.rb', line 17 def full_path Entangler.executor.generate_abs_path(@path) end |
#process ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/entangler/entangled_file.rb', line 25 def process if action == :create || action == :update create_parent_directory write_contents elsif action == :delete delete_file end end |