Class: DependencyTimelineAudit::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency-timeline-audit/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dependency-timeline-audit/config.rb', line 7

def initialize(options)
  @verbose = value_or_default(options[:verbose], false)
  @lockfile = value_or_default(options[:lockfile], 'Gemfile.lock')
  @outdated_threshold = value_or_default(options[:outdated_threshold], 3)

  # FIXME: There is probably a better way to handle the guard clauses and type casting
  if @outdated_threshold.to_i <= 0
    raise InvalidOption, "Outdated Threshold must be an integer greater than 0"
  end

  # TODO: activesupport is kinda hefty for just grabbing X.years.ago, remove
  @outdated_threshold = @outdated_threshold.to_i.years.ago
end

Instance Attribute Details

#lockfileObject (readonly)

Returns the value of attribute lockfile.



5
6
7
# File 'lib/dependency-timeline-audit/config.rb', line 5

def lockfile
  @lockfile
end

#outdated_thresholdObject (readonly)

Returns the value of attribute outdated_threshold.



5
6
7
# File 'lib/dependency-timeline-audit/config.rb', line 5

def outdated_threshold
  @outdated_threshold
end

#verboseObject (readonly)

Returns the value of attribute verbose.



5
6
7
# File 'lib/dependency-timeline-audit/config.rb', line 5

def verbose
  @verbose
end