Class: LintTrap::Language::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lint_trap/language/base.rb

Overview

Interface for languages

Direct Known Subclasses

CPP, CSS, CoffeeScript, Go, JSON, Java, JavaScript, Python, Ruby, SCSS, Unknown

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



7
8
9
# File 'lib/lint_trap/language/base.rb', line 7

def initialize
  @linters = []
end

Instance Attribute Details

#lintersObject (readonly)

Returns the value of attribute linters.



5
6
7
# File 'lib/lint_trap/language/base.rb', line 5

def linters
  @linters
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
22
23
# File 'lib/lint_trap/language/base.rb', line 19

def ==(other)
  return false unless other.respond_to?(:name, true)

  name == other.name
end

#add_linter(linter) ⇒ Object



15
16
17
# File 'lib/lint_trap/language/base.rb', line 15

def add_linter(linter)
  @linters << linter
end

#inspectObject



25
26
27
# File 'lib/lint_trap/language/base.rb', line 25

def inspect
  "<#{name}>"
end

#nameObject



11
12
13
# File 'lib/lint_trap/language/base.rb', line 11

def name
  self.class.name.split('::').last
end