Class: RailsTasker::TaskFile
- Inherits:
-
Object
- Object
- RailsTasker::TaskFile
- Defined in:
- lib/rails_tasker/task_file.rb
Constant Summary collapse
- UP_STATUS =
'up'.freeze
- DOWN_STATUS =
'down'.freeze
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#task_name ⇒ Object
readonly
Returns the value of attribute task_name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filename: '') ⇒ TaskFile
constructor
A new instance of TaskFile.
- #pending? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(filename: '') ⇒ TaskFile
Returns a new instance of TaskFile.
11 12 13 14 |
# File 'lib/rails_tasker/task_file.rb', line 11 def initialize(filename: '') @filename = filename @timestamp, @task_name = parse_filename end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
16 17 18 |
# File 'lib/rails_tasker/task_file.rb', line 16 def filename @filename end |
#task_name ⇒ Object (readonly)
Returns the value of attribute task_name.
16 17 18 |
# File 'lib/rails_tasker/task_file.rb', line 16 def task_name @task_name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
16 17 18 |
# File 'lib/rails_tasker/task_file.rb', line 16 def @timestamp end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rails_tasker/task_file.rb', line 28 def call load_object output = nil unless task_klass.nil? output = task_klass.call complete_task! unload_object end output end |
#pending? ⇒ Boolean
18 19 20 21 22 |
# File 'lib/rails_tasker/task_file.rb', line 18 def pending? @is_pending ||= !.empty? && !Task.completed_task?( version: ) end |
#status ⇒ Object
24 25 26 |
# File 'lib/rails_tasker/task_file.rb', line 24 def status pending? ? DOWN_STATUS : UP_STATUS end |