Class: Glaemscribe::API::PrePostProcessorOperator
- Inherits:
-
Object
- Object
- Glaemscribe::API::PrePostProcessorOperator
show all
- Defined in:
- lib/api/transcription_pre_post_processor.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PrePostProcessorOperator.
30
31
32
33
|
# File 'lib/api/transcription_pre_post_processor.rb', line 30
def initialize(mode, glaeml_element)
@mode = mode
@glaeml_element = glaeml_element
end
|
Instance Attribute Details
#finalized_glaeml_element ⇒ Object
Returns the value of attribute finalized_glaeml_element.
28
29
30
|
# File 'lib/api/transcription_pre_post_processor.rb', line 28
def finalized_glaeml_element
@finalized_glaeml_element
end
|
#glaeml_element ⇒ Object
Returns the value of attribute glaeml_element.
27
28
29
|
# File 'lib/api/transcription_pre_post_processor.rb', line 27
def glaeml_element
@glaeml_element
end
|
Instance Method Details
56
57
58
|
# File 'lib/api/transcription_pre_post_processor.rb', line 56
def apply
raise "Pure virtual method, should be overloaded."
end
|
#eval_arg(arg, trans_options) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/api/transcription_pre_post_processor.rb', line 35
def eval_arg(arg, trans_options)
return nil if arg.nil?
if arg =~ /^\\eval\s/
to_eval = $'
return Eval::Parser.new().parse(to_eval, trans_options)
end
return arg
end
|
#finalize(trans_options) ⇒ Object
52
53
54
|
# File 'lib/api/transcription_pre_post_processor.rb', line 52
def finalize(trans_options)
@finalized_glaeml_element = finalize_glaeml_element(@glaeml_element.clone, trans_options)
end
|
#finalize_glaeml_element(ge, trans_options) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/api/transcription_pre_post_processor.rb', line 44
def finalize_glaeml_element(ge, trans_options)
ge.args.map! { |arg| eval_arg(arg, trans_options) }
ge.children.each{ |child|
finalize_glaeml_element(child, trans_options)
}
ge
end
|