Class: PeakFlowUtils::HandlerText

Inherits:
ApplicationRecord show all
Defined in:
lib/peak_flow_utils/models/handler_text.rb

Instance Method Summary collapse

Instance Method Details

#array_keyObject



34
35
36
37
38
# File 'lib/peak_flow_utils/models/handler_text.rb', line 34

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

  match[1]
end

#array_noObject



40
41
42
43
44
# File 'lib/peak_flow_utils/models/handler_text.rb', line 40

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

  match[2].to_i
end

#finished?Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/peak_flow_utils/models/handler_text.rb', line 25

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

#key_show_with_fallbackObject



11
12
13
# File 'lib/peak_flow_utils/models/handler_text.rb', line 11

def key_show_with_fallback
  key_show.presence || last_key
end

#translationObject



15
16
17
18
19
20
21
22
23
# File 'lib/peak_flow_utils/models/handler_text.rb', line 15

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

#unfinished?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/peak_flow_utils/models/handler_text.rb', line 30

def unfinished?
  !finished?
end