module LLT::Review::Helpers::Parsing::Helper
Public Class Methods
new()
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 7 def initialize @result = Review::Helpers::Parsing::Result.new end
Public Instance Methods
result()
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 11 def result @result end
Private Instance Methods
add_complete_annotator()
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 44 def add_complete_annotator if annotator.complete? @result.annotators.add(annotator) @annotator = nil end end
annotator()
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 40 def annotator @annotator ||= Annotator.new end
namespace()
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 35 def namespace # has should be implemented by classes that use this module self.class end
parse_annotator_values(str)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 55 def parse_annotator_values(str) params = [:short, :name, :address, :uri] params.each do |param| if instance_variable_get("@in_#{param}") annotator.send("#{param}=", str) add_complete_annotator end end end
register_format(format)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 27 def register_format(format) @result.format = format end
register_language(language)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 31 def register_language(language) @result.lang = language end
register_sentence(value)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 17 def register_sentence(value) @sentence = namespace.const_get(:Sentence).new(value.to_i) @result.add(@sentence) end
register_word(value)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 22 def register_word(value) @word = namespace.const_get(:Word).new(value.to_i) @sentence.add(@word) end
set_annotator_variable(attr, val)
click to toggle source
# File lib/llt/review/helpers/parsing/helper.rb, line 51 def set_annotator_variable(attr, val) instance_variable_set("@in_#{attr}", val); end