class AjaxCat::Request::Phrase
Attributes
from[R]
to[R]
words[R]
Public Class Methods
new(words_list, alignment)
click to toggle source
# File lib/ajax-cat/request/table.rb, line 65 def initialize(words_list, alignment) alignment = alignment.split("=") source_alignment = parse(alignment[0]) target_alignment = parse(alignment[1]) @from = source_alignment[:from] @to = source_alignment[:to] @words = "" target_alignment[:from].upto(target_alignment[:to]) do |position| @words += " #{words_list[position]}" end @words.strip! end
Public Instance Methods
parse(alignment)
click to toggle source
# File lib/ajax-cat/request/table.rb, line 78 def parse(alignment) if alignment.include?("-") alignment = alignment.split("-") from = alignment[0].to_i to = alignment[1].to_i else from = alignment.to_i to = from end return {from: from, to: to} end