Class: Appium::Lint::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/appium_doc_lint/lint/base.rb

Overview

noinspection RubyArgCount

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Base

Appium::Lint::Base.new file: ‘/path/to/file’

Appium::Lint::Base.new data: ‘some markdown



9
10
11
12
# File 'lib/appium_doc_lint/lint/base.rb', line 9

def initialize opts
  @input    = opts.is_a?(OpenStruct) ? opts : Appium::Lint.new_input(opts)
  @warnings = Hash.new []
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



5
6
7
# File 'lib/appium_doc_lint/lint/base.rb', line 5

def input
  @input
end

#warningsObject (readonly)

Returns the value of attribute warnings.



5
6
7
# File 'lib/appium_doc_lint/lint/base.rb', line 5

def warnings
  @warnings
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/appium_doc_lint/lint/base.rb', line 28

def call
  raise NotImplementedError
end

#failObject

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/appium_doc_lint/lint/base.rb', line 24

def fail
  raise NotImplementedError
end

#warn(line_number, extra = nil) ⇒ warnings

Record a warning on a zero indexed line number

Parameters:

  • line_number (int)

    line number to warn on

Returns:



18
19
20
21
22
# File 'lib/appium_doc_lint/lint/base.rb', line 18

def warn line_number, extra=nil
  message = extra ? fail + ' ' + extra : fail
  warnings[line_number + 1] += [message]
  warnings
end