Class: Bundler::Audit::Presenter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/audit/presenter/base.rb

Direct Known Subclasses

Junit, Plain

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell, options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/bundler/audit/presenter/base.rb', line 8

def initialize(shell, options)
  @shell = shell
  @options = options
  @warnings = []
  @advisory_bundles = []
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/bundler/audit/presenter/base.rb', line 5

def options
  @options
end

#shellObject (readonly)

Returns the value of attribute shell.



6
7
8
# File 'lib/bundler/audit/presenter/base.rb', line 6

def shell
  @shell
end

Instance Method Details

#exit_codeObject



27
28
29
# File 'lib/bundler/audit/presenter/base.rb', line 27

def exit_code
  problematic? ? 1 : 0
end

Raises:

  • (RuntimeError)


23
24
25
# File 'lib/bundler/audit/presenter/base.rb', line 23

def print_report
  raise RuntimeError, "Not Implemented"
end

#problematic?Boolean (protected)

Returns:

  • (Boolean)


33
34
35
# File 'lib/bundler/audit/presenter/base.rb', line 33

def problematic?
  @warnings.any? || @advisory_bundles.any?
end

#push_advisory(advisory) ⇒ Object



19
20
21
# File 'lib/bundler/audit/presenter/base.rb', line 19

def push_advisory(advisory)
  @advisory_bundles.push(advisory)
end

#push_warning(message) ⇒ Object



15
16
17
# File 'lib/bundler/audit/presenter/base.rb', line 15

def push_warning(message)
  @warnings.push(message)
end