Class: Glaemscribe::API::TranscriptionPrePostProcessor
- Inherits:
-
Object
- Object
- 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.
60 61 62 63 |
# File 'lib/api/transcription_pre_post_processor.rb', line 60 def initialize(mode) @mode = mode @root_code_block = IfTree::CodeBlock.new end |
Instance Attribute Details
#operators ⇒ Object (readonly)
Returns the value of attribute operators.
58 59 60 |
# File 'lib/api/transcription_pre_post_processor.rb', line 58 def operators @operators end |
#root_code_block ⇒ Object (readonly)
Returns the value of attribute root_code_block.
56 57 58 |
# File 'lib/api/transcription_pre_post_processor.rb', line 56 def root_code_block @root_code_block end |
Instance Method Details
#descend_if_tree(code_block, trans_options) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/api/transcription_pre_post_processor.rb', line 65 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
85 86 87 88 89 90 91 92 93 |
# File 'lib/api/transcription_pre_post_processor.rb', line 85 def finalize() @operators = [] # Select operators depending on conditions descend_if_tree(@root_code_block, ) # Reevaluate operator arguments @operators.each{ |op| op.finalize() } end |