Class: GemChangelogDiff::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_changelog_diff/configuration.rb

Constant Summary collapse

VALID_KEYS =
%i[github_token cache_enabled cache_ttl default_format concurrency ignore_gems no_color].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
# File 'lib/gem_changelog_diff/configuration.rb', line 10

def initialize
  @cache_enabled = true
  @cache_ttl = 86_400
  @default_format = "text"
  @concurrency = 4
  @ignore_gems = []
  @no_color = false
end

Instance Attribute Details

#cache_enabledObject

Returns the value of attribute cache_enabled.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def cache_enabled
  @cache_enabled
end

#cache_ttlObject

Returns the value of attribute cache_ttl.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def cache_ttl
  @cache_ttl
end

#concurrencyObject

Returns the value of attribute concurrency.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def concurrency
  @concurrency
end

#default_formatObject

Returns the value of attribute default_format.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def default_format
  @default_format
end

#github_tokenObject

Returns the value of attribute github_token.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def github_token
  @github_token
end

#ignore_gemsObject

Returns the value of attribute ignore_gems.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def ignore_gems
  @ignore_gems
end

#no_colorObject

Returns the value of attribute no_color.



5
6
7
# File 'lib/gem_changelog_diff/configuration.rb', line 5

def no_color
  @no_color
end

Instance Method Details

#apply(hash) ⇒ Object



19
20
21
22
23
# File 'lib/gem_changelog_diff/configuration.rb', line 19

def apply(hash)
  hash.each do |key, value|
    public_send(:"#{key}=", value) if VALID_KEYS.include?(key) && !value.nil?
  end
end