Class: I18nFlow::Validator::FileScope

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_flow/validator/file_scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast, filepath:) ⇒ FileScope

Returns a new instance of FileScope.



9
10
11
12
# File 'lib/i18n_flow/validator/file_scope.rb', line 9

def initialize(ast, filepath:)
  @ast = ast
  @filepath = filepath
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



6
7
8
# File 'lib/i18n_flow/validator/file_scope.rb', line 6

def ast
  @ast
end

#filepathObject (readonly)

Returns the value of attribute filepath.



7
8
9
# File 'lib/i18n_flow/validator/file_scope.rb', line 7

def filepath
  @filepath
end

Instance Method Details

#errorsObject



23
24
25
# File 'lib/i18n_flow/validator/file_scope.rb', line 23

def errors
  @errors ||= []
end

#filepath_scopesObject



14
15
16
# File 'lib/i18n_flow/validator/file_scope.rb', line 14

def filepath_scopes
  @filepath_scopes ||= I18nFlow::Util.filepath_to_scope(filepath)
end

#validate!Object



18
19
20
21
# File 'lib/i18n_flow/validator/file_scope.rb', line 18

def validate!
  @errors = nil
  validate_scope(ast, scopes: filepath_scopes)
end