Class: Glaemscribe::API::TranscriptionPrePostProcessor
- Defined in:
- lib/api/transcription_pre_post_processor.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#operators ⇒ Object
readonly
Returns the value of attribute operators.
-
#root_code_block ⇒ Object
readonly
Returns the value of attribute root_code_block.
Instance Method Summary collapse
- #descend_if_tree(code_block, trans_options) ⇒ Object
- #finalize(trans_options) ⇒ Object
-
#initialize(mode) ⇒ TranscriptionPrePostProcessor
constructor
A new instance of TranscriptionPrePostProcessor.
Constructor Details
#initialize(mode) ⇒ TranscriptionPrePostProcessor
Returns a new instance of TranscriptionPrePostProcessor.
66 67 68 69 |
# File 'lib/api/transcription_pre_post_processor.rb', line 66 def initialize(mode) @mode = mode @root_code_block = IfTree::CodeBlock.new end |
Instance Attribute Details
#operators ⇒ Object (readonly)
Returns the value of attribute operators.
64 65 66 |
# File 'lib/api/transcription_pre_post_processor.rb', line 64 def operators @operators end |
#root_code_block ⇒ Object (readonly)
Returns the value of attribute root_code_block.
62 63 64 |
# File 'lib/api/transcription_pre_post_processor.rb', line 62 def root_code_block @root_code_block end |
Instance Method Details
#descend_if_tree(code_block, trans_options) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/api/transcription_pre_post_processor.rb', line 71 def descend_if_tree(code_block, ) 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, ) == true) descend_if_tree(if_cond.child_code_block, ) break end } end } end |
#finalize(trans_options) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/api/transcription_pre_post_processor.rb', line 91 def finalize() @operators = [] # Select operators depending on conditions descend_if_tree(@root_code_block, ) # Reevaluate operator arguments @operators.each{ |op| op.finalize() } end |