Class: MovieLengthTask

Inherits:
Task show all
Defined in:
app/models/movie_length_task.rb

Defined Under Namespace

Classes: MovieLengthData

Instance Method Summary collapse

Methods inherited from Task

#find_batch, #find_batch_requests, #get_descriptor_value, #get_subclass_attribute_options, get_subclass_attribute_options, #get_subclass_attribute_value, get_subclass_attributes, #get_subclass_attributes, init_class, #set_descriptor_value, set_subclass_attribute, #set_subclass_attribute_value, #sub_events_for

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#create_render_element(request) ⇒ Object


8
9
10
# File 'app/models/movie_length_task.rb', line 8

def create_render_element(request)
  request.asset && MovieLengthData.new(request)
end

#do_task(workflow, params) ⇒ Object


21
22
23
# File 'app/models/movie_length_task.rb', line 21

def do_task(workflow, params)
  workflow.do_movie_length_task(self, params)
end

#included_for_do_taskObject


35
36
37
# File 'app/models/movie_length_task.rb', line 35

def included_for_do_task
  [{ requests: :asset }, :pipeline]
end

#included_for_render_taskObject


39
40
41
# File 'app/models/movie_length_task.rb', line 39

def included_for_render_task
  [{ requests: :asset }, :pipeline]
end

#partialObject


12
13
14
# File 'app/models/movie_length_task.rb', line 12

def partial
  'movie_length_batches'
end

#render_task(workflow, params) ⇒ Object


16
17
18
19
# File 'app/models/movie_length_task.rb', line 16

def render_task(workflow, params)
  super
  workflow.render_movie_length_task(self, params)
end

#valid_movie_length?(movie_length) ⇒ Boolean

Returns:

  • (Boolean)

25
26
27
28
29
30
31
32
33
# File 'app/models/movie_length_task.rb', line 25

def valid_movie_length?(movie_length)
  return false if movie_length.blank?

  movie_length.split(/,/).each do |movie_timing|
    return false if (movie_timing.blank? || !movie_timing.to_i.is_a?(Integer) || movie_timing.to_i < 0)
  end

  true
end