class MovieMasher::ChainModule

a theme or transition filter chain

Attributes

input[W]

Public Class Methods

new(mod_input, mash_input, applied_input) click to toggle source
Calls superclass method MovieMasher::Chain::new
# File lib/graphs/chains.rb, line 24
def initialize(mod_input, mash_input, applied_input)
  # applied_input is same as mod_input for themes
  raise(Error::Parameter, 'no mod_input') unless mod_input

  # raise(Error::Parameter, 'no mash_input') unless mash_input
  # raise(Error::Parameter, 'no applied_input') unless applied_input
  @applied_input = applied_input
  super(mod_input, mash_input)
end

Public Instance Methods

chain_command(scope) click to toggle source
Calls superclass method MovieMasher::Chain#chain_command
# File lib/graphs/chains.rb, line 20
def chain_command(scope)
  super(input_scope(scope))
end
initialize_filters() click to toggle source
# File lib/graphs/chains.rb, line 34
def initialize_filters
  unless _present(@input[:filters]) && @input[:filters].is_a?(Array)
    raise(Error::JobInput, "ChainModule with no filters #{@input}")
  end

  @filters += @input[:filters].map do |filter_config|
    FilterEvaluated.new(filter_config, @job_input, @applied_input)
  end
end
input_scope(scope) click to toggle source
# File lib/graphs/chains.rb, line 44
def input_scope(scope)
  scope = scope.dup # shallow copy, so any objects are just pointers
  properties = @input[:properties]
  if _present(properties) && properties.is_a?(Hash)
    properties.each do |property, ob|
      scope[property] = @input[property] || ob[:value]
      # puts "#{property} = #{scope[property]}"
    end
  end
  scope
end