Class: PlatformosCheck::DisabledCheck
- Inherits:
-
Object
- Object
- PlatformosCheck::DisabledCheck
- Defined in:
- lib/platformos_check/disabled_check.rb
Instance Attribute Summary collapse
-
#app_file ⇒ Object
readonly
Returns the value of attribute app_file.
-
#first_line ⇒ Object
Returns the value of attribute first_line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ranges ⇒ Object
readonly
Returns the value of attribute ranges.
Instance Method Summary collapse
- #disabled?(index) ⇒ Boolean
- #end_index=(index) ⇒ Object
-
#initialize(app_file, name) ⇒ DisabledCheck
constructor
A new instance of DisabledCheck.
- #last ⇒ Object
- #missing_end_index? ⇒ Boolean
- #start_index=(index) ⇒ Object
Constructor Details
#initialize(app_file, name) ⇒ DisabledCheck
Returns a new instance of DisabledCheck.
10 11 12 13 14 15 |
# File 'lib/platformos_check/disabled_check.rb', line 10 def initialize(app_file, name) @app_file = app_file @name = name @ranges = [] @first_line = false end |
Instance Attribute Details
#app_file ⇒ Object (readonly)
Returns the value of attribute app_file.
7 8 9 |
# File 'lib/platformos_check/disabled_check.rb', line 7 def app_file @app_file end |
#first_line ⇒ Object
Returns the value of attribute first_line.
8 9 10 |
# File 'lib/platformos_check/disabled_check.rb', line 8 def first_line @first_line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/platformos_check/disabled_check.rb', line 7 def name @name end |
#ranges ⇒ Object (readonly)
Returns the value of attribute ranges.
7 8 9 |
# File 'lib/platformos_check/disabled_check.rb', line 7 def ranges @ranges end |
Instance Method Details
#disabled?(index) ⇒ Boolean
29 30 31 32 |
# File 'lib/platformos_check/disabled_check.rb', line 29 def disabled?(index) (index == 0 && first_line) || ranges.any? { |range| range.cover?(index) } end |
#end_index=(index) ⇒ Object
23 24 25 26 27 |
# File 'lib/platformos_check/disabled_check.rb', line 23 def end_index=(index) return if ranges.empty? || !last.end.nil? @ranges << (@ranges.pop.begin..index) end |
#last ⇒ Object
34 35 36 |
# File 'lib/platformos_check/disabled_check.rb', line 34 def last ranges.last end |
#missing_end_index? ⇒ Boolean
38 39 40 41 42 |
# File 'lib/platformos_check/disabled_check.rb', line 38 def missing_end_index? return false if first_line && ranges.size == 1 last&.end.nil? end |
#start_index=(index) ⇒ Object
17 18 19 20 21 |
# File 'lib/platformos_check/disabled_check.rb', line 17 def start_index=(index) return unless ranges.empty? || !last.end.nil? @ranges << (index..) end |