Class: Mirrors::Marker

Inherits:
Object
  • Object
show all
Defined in:
lib/mirrors/index/marker.rb

Constant Summary collapse

TYPE_TASK =
'mirrors.marker.task'.freeze
TYPE_PROBLEM =
'mirrors.marker.problem'.freeze
TYPE_TEXT =
'mirrors.marker.text'.freeze
TYPE_CLASS_REFERENCE =
'mirrors.marker.text.class_reference'.freeze
TYPE_METHOD_REFERENCE =
'mirrors.marker.text.method_reference'.freeze
TYPE_FIELD_REFERENCE =
'mirrors.marker.text.field_reference'.freeze
NO_LINE =
-1
NO_COLUMN =
-1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: TYPE_TASK, message: '', file: nil, line: NO_LINE, start_column: NO_COLUMN, end_column: NO_COLUMN) ⇒ Marker

Returns a new instance of Marker.



15
16
17
18
19
20
21
22
# File 'lib/mirrors/index/marker.rb', line 15

def initialize(type: TYPE_TASK, message: '', file: nil, line: NO_LINE, start_column: NO_COLUMN, end_column: NO_COLUMN)
  @type = type
  @message = message
  @file = file
  @line = line
  @start_column = start_column
  @end_column = end_column
end

Instance Attribute Details

#end_columnObject (readonly)

Returns the value of attribute end_column.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def end_column
  @end_column
end

#fileObject (readonly)

Returns the value of attribute file.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def message
  @message
end

#start_columnObject (readonly)

Returns the value of attribute start_column.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def start_column
  @start_column
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/mirrors/index/marker.rb', line 13

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/mirrors/index/marker.rb', line 24

def ==(other)
  type == other.type && message == other.message && line == other.line && start_column == other.start_column && end_column == other.end_column
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/mirrors/index/marker.rb', line 28

def eql?(other)
  self == other
end

#hashObject



32
33
34
# File 'lib/mirrors/index/marker.rb', line 32

def hash
  [@type, @message, @line, @start_column, @end_column].hash
end

#hashyObject



36
37
38
# File 'lib/mirrors/index/marker.rb', line 36

def hashy
  [@type, @message, @line, @start_column, @end_column]
end