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.



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

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

Instance Method Details

#apply(l) ⇒ Object



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

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

#eval_arg(arg, trans_options) ⇒ Object



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

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



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

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