Class: I18nFlow::Validator::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Error

Returns a new instance of Error.



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

def initialize(key)
  @key = key
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/i18n_flow/validator/errors.rb', line 4

def file
  @file
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/i18n_flow/validator/errors.rb', line 3

def key
  @key
end

#lineObject (readonly)

Returns the value of attribute line.



5
6
7
# File 'lib/i18n_flow/validator/errors.rb', line 5

def line
  @line
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
# File 'lib/i18n_flow/validator/errors.rb', line 11

def ==(other)
  return false unless other.is_a?(self.class)
  data == other.data
end

#dataObject



16
17
18
# File 'lib/i18n_flow/validator/errors.rb', line 16

def data
  [key]
end

#set_location(node) ⇒ Object



24
25
26
27
28
# File 'lib/i18n_flow/validator/errors.rb', line 24

def set_location(node)
  @file = node.file_path
  @line = node.start_line
  self
end

#single?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/i18n_flow/validator/errors.rb', line 20

def single?
  !!@single
end