Class: StatModule::Location
Constant Summary
Constants inherited from JSONable
JSONable::FORMATTING_BALL, JSONable::FORMATTING_CHECKMARK, JSONable::FORMATTING_STAR, JSONable::FORMATTING_WARNING
Instance Method Summary collapse
-
#begin_column ⇒ Object
Get begin column number.
-
#begin_column=(begin_column) ⇒ Object
Set begin column.
-
#begin_line ⇒ Object
Get begin line number.
-
#begin_line=(begin_line) ⇒ Object
Set begin line.
-
#end_column ⇒ Object
Get end column number.
-
#end_column=(end_column) ⇒ Object
Set end column.
-
#end_line ⇒ Object
Get end line number.
-
#end_line=(end_line) ⇒ Object
Set end line.
-
#initialize(path, hash = nil) ⇒ Location
constructor
Initialize new Location object.
-
#path ⇒ Object
Get path.
-
#path=(path) ⇒ Object
Set path.
-
#print ⇒ Object
Get formatted information about location.
Methods inherited from JSONable
Constructor Details
#initialize(path, hash = nil) ⇒ Location
Initialize new Location object
Params:
process-
String, required
hash-
Hash, can be null
12 13 14 15 16 17 18 19 |
# File 'lib/location.rb', line 12 def initialize(path, hash = nil) if hash.is_a? Hash super(hash) return end raise TypeException unless path.is_a?(String) @path = path end |
Instance Method Details
#begin_column ⇒ Object
Get begin column number
65 66 67 |
# File 'lib/location.rb', line 65 def begin_column @beginColumn end |
#begin_column=(begin_column) ⇒ Object
Set begin column
Params:
begin_column-
Integer
58 59 60 61 |
# File 'lib/location.rb', line 58 def begin_column=(begin_column) raise TypeException unless begin_column.is_a?(Integer) @beginColumn = begin_column end |
#begin_line ⇒ Object
Get begin line number
49 50 51 |
# File 'lib/location.rb', line 49 def begin_line @beginLine end |
#begin_line=(begin_line) ⇒ Object
Set begin line
Params:
begin_line-
Integer
42 43 44 45 |
# File 'lib/location.rb', line 42 def begin_line=(begin_line) raise TypeException unless begin_line.is_a?(Integer) @beginLine = begin_line end |
#end_column ⇒ Object
Get end column number
97 98 99 |
# File 'lib/location.rb', line 97 def end_column @endColumn end |
#end_column=(end_column) ⇒ Object
Set end column
Params:
end_column-
Integer
90 91 92 93 |
# File 'lib/location.rb', line 90 def end_column=(end_column) raise TypeException unless end_column.is_a?(Integer) @endColumn = end_column end |
#end_line ⇒ Object
Get end line number
81 82 83 |
# File 'lib/location.rb', line 81 def end_line @endLine end |
#end_line=(end_line) ⇒ Object
Set end line
Params:
end_line-
Integer
74 75 76 77 |
# File 'lib/location.rb', line 74 def end_line=(end_line) raise TypeException unless end_line.is_a?(Integer) @endLine = end_line end |
#path ⇒ Object
Get path
33 34 35 |
# File 'lib/location.rb', line 33 def path @path end |
#path=(path) ⇒ Object
Set path
Params:
path-
String
26 27 28 29 |
# File 'lib/location.rb', line 26 def path=(path) raise TypeException unless path.is_a?(String) @path = path end |
#print ⇒ Object
Get formatted information about location
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/location.rb', line 103 def print result = "in #{path}" if !begin_line.nil? && !end_line.nil? if begin_line != end_line if !begin_column.nil? && !end_column.nil? result += ", line #{begin_line}:#{begin_column} to line #{end_line}:#{end_column}" elsif !begin_column.nil? && end_column.nil? result += ", line #{begin_line}:#{begin_column} to line #{end_line}" elsif begin_column.nil? && !end_column.nil? result += ", line #{begin_line} to line #{end_line}:#{end_column}" else result += ", lines #{begin_line}-#{end_line}" end else if begin_column.nil? result += ", line #{begin_line}" else result += ", line #{begin_line}:#{begin_column}" result += "-#{end_column}" unless end_column.nil? end end end result end |