class ArticleFixtureGen::CLI::Config

CLI implementation class that reads YAML config from file and uses it to create an `ArticleFixtureGen::Config` instance.

Attributes

defaults[R]
filename[R]
overrides[R]

Public Class Methods

call(filename:, defaults: nil, overrides: {}) click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 13
def self.call(filename:, defaults: nil, overrides: {})
  new(filename, defaults, overrides).call
end
new(filename, defaults, overrides) click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 23
def initialize(filename, defaults, overrides)
  @defaults = Internals.defaults_based_on(defaults)
  @filename = filename
  @overrides = overrides
  self
end

Public Instance Methods

call() click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 17
def call
  ArticleFixtureGen::Config.new final
end

Private Instance Methods

file_contents() click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 34
def file_contents
  YAML.load_file filename
end
final() click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 38
def final
  defaults.merge(non_defaults)
end
non_defaults() click to toggle source
# File lib/article_fixture_gen/cli/config.rb, line 42
def non_defaults
  file_contents.merge(overrides)
end