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
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_no ⇒ Object
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
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_fallback ⇒ Object
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 |
#translation ⇒ Object
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
30 31 32 |
# File 'lib/peak_flow_utils/models/handler_text.rb', line 30 def unfinished? !finished? end |