Class: PeakFlowUtils::HandlerText
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PeakFlowUtils::HandlerText
- Defined in:
- lib/peak_flow_utils/models/handler_text.rb
Instance Method Summary collapse
- #array_key ⇒ Object
- #array_no ⇒ Object
- #finished? ⇒ Boolean
- #key_show_with_fallback ⇒ Object
- #translation ⇒ Object
- #unfinished? ⇒ Boolean
Instance Method Details
#array_key ⇒ Object
35 36 37 38 39 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 35 def array_key return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/)) match[1] end |
#array_no ⇒ Object
41 42 43 44 45 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 41 def array_no return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/)) match[2].to_i end |
#finished? ⇒ Boolean
26 27 28 29 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 26 def finished? @_finished = translation.finished? if @finished.nil? @_finished end |
#key_show_with_fallback ⇒ Object
12 13 14 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 12 def key_show_with_fallback key_show.presence || last_key end |
#translation ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 16 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
31 32 33 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 31 def unfinished? !finished? end |