Class: AwesomeTranslations::CacheDatabaseGenerator::HandlerTranslation

Inherits:
BazaModels::Model
  • Object
show all
Defined in:
lib/awesome_translations/cache_database_generator/handler_translation.rb

Instance Method Summary collapse

Instance Method Details

#array_keyObject



43
44
45
46
47
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 43

def array_key
  return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/))

  match[1]
end

#array_noObject



49
50
51
52
53
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 49

def array_no
  return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/))

  match[2].to_i
end

#finished?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 34

def finished?
  @_finished = translation.finished? if @finished.nil?
  @_finished
end

#key_show_with_fallbackObject



20
21
22
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 20

def key_show_with_fallback
  key_show.presence || last_key
end

#translationObject



24
25
26
27
28
29
30
31
32
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 24

def translation
  @translation ||= AwesomeTranslations::Translation.new(
    key: key,
    dir: dir,
    full_path: full_path,
    file_path: file_path,
    line_no: line_no
  )
end

#unfinished?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/awesome_translations/cache_database_generator/handler_translation.rb', line 39

def unfinished?
  !finished?
end