Class: PrChangelog::Config
- Inherits:
-
Object
- Object
- PrChangelog::Config
- Defined in:
- lib/pr_changelog/config.rb
Overview
Loads the configuration
Constant Summary collapse
- DEFAULTS =
{ format: 'plain', strategy: 'merge', tags: [ { prefix: 'feature', emoji: '⭐️', title: 'New features' }, { prefix: 'fix', emoji: '🐛', title: 'Fixes' }, { prefix: 'improvement', emoji: '💎', title: 'Improvements' }, { prefix: 'internal', emoji: '👨💻', title: 'Internal' }, { prefix: 'unclassified', emoji: '❓', title: 'Unclassified' } ] }.freeze
Instance Method Summary collapse
- #default_format ⇒ Object
- #default_strategy ⇒ Object
-
#initialize(file = nil) ⇒ Config
constructor
A new instance of Config.
- #tags ⇒ Object
Constructor Details
#initialize(file = nil) ⇒ Config
Returns a new instance of Config.
40 41 42 43 44 45 46 47 |
# File 'lib/pr_changelog/config.rb', line 40 def initialize(file = nil) @file = file || '.pr_changelog.json' @loaded_data = {} return unless File.exist?(@file) @loaded_data = JSON.parse(File.read(@file), symbolize_names: true) end |
Instance Method Details
#default_format ⇒ Object
49 50 51 |
# File 'lib/pr_changelog/config.rb', line 49 def default_format loaded_data[:format] || DEFAULTS[:format] end |
#default_strategy ⇒ Object
53 54 55 |
# File 'lib/pr_changelog/config.rb', line 53 def default_strategy loaded_data[:strategy] || DEFAULTS[:strategy] end |
#tags ⇒ Object
57 58 59 |
# File 'lib/pr_changelog/config.rb', line 57 def loaded_data[:tags] || DEFAULTS[:tags] end |