Class: I18nChecker::NotFound::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_checker/not_found/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale_texts = []) ⇒ Result

Returns a new instance of Result.



6
7
8
# File 'lib/i18n_checker/not_found/result.rb', line 6

def initialize(locale_texts = [])
  @locale_texts = locale_texts
end

Instance Attribute Details

#locale_textsObject (readonly)

Returns the value of attribute locale_texts.



4
5
6
# File 'lib/i18n_checker/not_found/result.rb', line 4

def locale_texts
  @locale_texts
end

Instance Method Details

#each_file(&block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/i18n_checker/not_found/result.rb', line 14

def each_file(&block)
  file_texts = locale_texts.group_by(&:file)
  file_texts.each do |file, texts|
    texts.sort do |a, b|
      lr = a.line <=> b.line
      next lr if lr != 0
      a.column <=> b.column
    end
    yield(file, texts)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/i18n_checker/not_found/result.rb', line 10

def empty?
  locale_texts.empty?
end