class TidyI18n::TranslationKeys::RepeatKeyBuilder

Attributes

building_sequence[RW]
current_sequence_values[RW]
key_parts[RW]
parsed_keys[RW]

Public Class Methods

new() click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 15
def initialize
  self.key_parts = []
  self.parsed_keys = []
  self.current_sequence_values = []
end

Public Instance Methods

end_document(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 46
def end_document(*row); end
end_mapping(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 42
def end_mapping(*row)
  @key_parts.pop
end
end_sequence() click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 48
def end_sequence
  append_parsed_key(current_sequence_values)
  self.building_sequence = false
  self.current_sequence_values = []
end
end_stream(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 47
def end_stream(*row); end
scalar(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 31
def scalar(*row)
  if second_half_of_pair?
    append_parsed_key(row.first)
  elsif building_sequence?
    current_sequence_values << row.first
  else
    key_parts << row.first
    @most_recent_scalar = row
  end
end
start_document(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 22
def start_document(*row); end
start_mapping(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 27
def start_mapping(*row)
  @most_recent_scalar = nil
end
start_sequence(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 23
def start_sequence(*row)
  self.building_sequence = true
end
start_stream(*row) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 21
def start_stream(*row); end

Private Instance Methods

append_parsed_key(value) click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 56
def append_parsed_key(value)
  parsed_keys << TranslationKey.new(key_parts.join("."), value)
  key_parts.pop
  @most_recent_scalar = nil
end
building_sequence?() click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 62
def building_sequence?
  building_sequence
end
second_half_of_pair?() click to toggle source
# File lib/tidy_i18n/translation_keys.rb, line 66
def second_half_of_pair?
  @most_recent_scalar && !building_sequence?
end