Class: GemChangelogDiff::Configuration
- Inherits:
-
Object
- Object
- GemChangelogDiff::Configuration
- Defined in:
- lib/gem_changelog_diff/configuration.rb
Overview
Holds runtime settings for the gem (token, cache, format, timeouts).
Constant Summary collapse
- VALID_KEYS =
%i[github_token cache_enabled cache_ttl default_format concurrency ignore_gems no_color request_timeout total_timeout].freeze
Instance Attribute Summary collapse
- #cache_enabled ⇒ String, ...
- #cache_ttl ⇒ String, ...
- #concurrency ⇒ String, ...
- #default_format ⇒ String, ...
- #github_token ⇒ String, ...
- #ignore_gems ⇒ String, ...
- #no_color ⇒ String, ...
- #request_timeout ⇒ String, ...
- #total_timeout ⇒ String, ...
Instance Method Summary collapse
-
#apply(hash) ⇒ void
Applies a hash of settings, ignoring unknown keys and nil values.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gem_changelog_diff/configuration.rb', line 22 def initialize @cache_enabled = true @cache_ttl = 86_400 @default_format = "text" @concurrency = 4 @ignore_gems = [] @no_color = false @request_timeout = 10 @total_timeout = 120 end |
Instance Attribute Details
#cache_enabled ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def cache_enabled @cache_enabled end |
#cache_ttl ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def cache_ttl @cache_ttl end |
#concurrency ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def concurrency @concurrency end |
#default_format ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def default_format @default_format end |
#github_token ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def github_token @github_token end |
#ignore_gems ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def ignore_gems @ignore_gems end |
#no_color ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def no_color @no_color end |
#request_timeout ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def request_timeout @request_timeout end |
#total_timeout ⇒ String, ...
15 16 17 |
# File 'lib/gem_changelog_diff/configuration.rb', line 15 def total_timeout @total_timeout end |
Instance Method Details
#apply(hash) ⇒ void
This method returns an undefined value.
Applies a hash of settings, ignoring unknown keys and nil values.
36 37 38 39 40 |
# File 'lib/gem_changelog_diff/configuration.rb', line 36 def apply(hash) hash.each do |key, value| public_send(:"#{key}=", value) if VALID_KEYS.include?(key) && !value.nil? end end |