Class: Glaemscribe::API::PrePostProcessorOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/api/transcription_pre_post_processor.rb

Direct Known Subclasses

PostProcessorOperator, PreProcessorOperator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_args) ⇒ PrePostProcessorOperator

Returns a new instance of PrePostProcessorOperator.



30
31
32
# File 'lib/api/transcription_pre_post_processor.rb', line 30

def initialize(raw_args)
  @raw_args = raw_args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



27
28
29
# File 'lib/api/transcription_pre_post_processor.rb', line 27

def args
  @args
end

#raw_argsObject (readonly)

Returns the value of attribute raw_args.



28
29
30
# File 'lib/api/transcription_pre_post_processor.rb', line 28

def raw_args
  @raw_args
end

Instance Method Details

#applyObject



50
51
52
# File 'lib/api/transcription_pre_post_processor.rb', line 50

def apply
  raise "Pure virtual method, should be overloaded."
end

#eval_arg(arg, trans_options) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/api/transcription_pre_post_processor.rb', line 34

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



43
44
45
46
47
48
# File 'lib/api/transcription_pre_post_processor.rb', line 43

def finalize(trans_options)
  @args = []
  @raw_args.each{ |arg|
    @args << eval_arg(arg, trans_options)
  }
end