class Glaemscribe::API::TranscriptionPrePostProcessor

Attributes

operators[R]
root_code_block[R]

Public Class Methods

new(mode) click to toggle source
# File lib/api/transcription_pre_post_processor.rb, line 65
def initialize(mode)
  @mode             = mode
  @root_code_block  = IfTree::CodeBlock.new 
end

Public Instance Methods

descend_if_tree(code_block, trans_options) click to toggle source
# File lib/api/transcription_pre_post_processor.rb, line 70
def descend_if_tree(code_block, trans_options)
  code_block.terms.each{ |term|         
    if(term.is_pre_post_processor_operators?)
      term.operators.each{ |operator|
        @operators << operator
      } 
    else
      term.if_conds.each{ |if_cond|
        
        if_eval = Eval::Parser.new()
        
        if(if_eval.parse(if_cond.expression, trans_options) == true)
          descend_if_tree(if_cond.child_code_block, trans_options)
          break
        end
      }
    end
  }
end
finalize(trans_options) click to toggle source
# File lib/api/transcription_pre_post_processor.rb, line 90
def finalize(trans_options)
  @operators = []
  # Select operators depending on conditions
  descend_if_tree(@root_code_block, trans_options)
  # Reevaluate operator arguments
  @operators.each{ |op|
    op.finalize(trans_options)
  }
end