Class: Texico::Template::FileStatus
- Inherits:
-
Object
- Object
- Texico::Template::FileStatus
- Defined in:
- lib/texico/template/file_status.rb
Overview
FileStatus
The FileStatus object represents the result of a copy command on a template file. This class should never be used directly.
Constant Summary collapse
- STATUS =
i[successful target_exist replaced_target].freeze
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(file, status = STATUS[0]) ⇒ FileStatus
constructor
A new instance of FileStatus.
- #status ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file, status = STATUS[0]) ⇒ FileStatus
Returns a new instance of FileStatus.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/texico/template/file_status.rb', line 12 def initialize(file, status = STATUS[0]) unless STATUS.include?(status) || status.is_a?(Exception) raise ArgumentError, 'Unknown status' end @status = status @file = file freeze end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
10 11 12 |
# File 'lib/texico/template/file_status.rb', line 10 def file @file end |
Instance Method Details
#status ⇒ Object
27 28 29 |
# File 'lib/texico/template/file_status.rb', line 27 def status @status.is_a?(Exception) ? :template_error : @status end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/texico/template/file_status.rb', line 23 def to_s "#{file.basename} [#{status}]" end |