Class: GemLint::Strategies::AbstractStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_lint/strategies/abstract_strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ AbstractStrategy

Returns a new instance of AbstractStrategy.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 8

def initialize(args = {})
  @filename = args[:filename]
  @path     = args[:data_path]
  @metadata_path = args[:metadata_path]

  raise ArgumentError, "#{@path} is not a directory" unless File.directory?(@path)
  raise ArgumentError, "#{@metadata_path} is not a file" unless File.file?(@metadata_path)
  raise ArgumentError, ":filename must be a filename ending in gem" unless @filename.to_s[-4,4] == ".gem"
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



6
7
8
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 6

def filename
  @filename
end

#metadata_pathObject (readonly)

Returns the value of attribute metadata_path.



6
7
8
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 6

def 
  @metadata_path
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 6

def path
  @path
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 22

def description
  raise "this should be implemented by concrete subclasses"
end

#fail?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 26

def fail?
  raise "this should be implemented by concrete subclasses"
end

#levelObject



30
31
32
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 30

def level
  raise "this should be implemented by concrete subclasses"
end

#level_charObject



18
19
20
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 18

def level_char
  self.level.to_s[0,1].upcase
end

#tagObject



34
35
36
# File 'lib/gem_lint/strategies/abstract_strategy.rb', line 34

def tag
  raise "this should be implemented by concrete subclasses"
end