class Dotpretty::Options

Attributes

color_palette[RW]
http_client[RW]
output[RW]
reporter_name[RW]

Public Class Methods

build(command_line_args) click to toggle source
# File lib/dotpretty/options.rb, line 10
def self.build(command_line_args)
  color_palette = command_line_args[:color] ? Dotpretty::ColorPalettes::Bash : Dotpretty::ColorPalettes::Null
  http_client = Dotpretty::Http::Client.new({
    api_root: "http://localhost:4567"
  })
  reporter_name = command_line_args.fetch(:reporter_name)
  return Dotpretty::Options.new({
    color_palette: color_palette,
    http_client: http_client,
    output: command_line_args.fetch(:output),
    reporter_name: reporter_name
  })
end
new(color_palette:, http_client: Dotpretty::Http::NullClient.new, output:, reporter_name:) click to toggle source
# File lib/dotpretty/options.rb, line 24
def initialize(color_palette:, http_client: Dotpretty::Http::NullClient.new, output:, reporter_name:)
  self.color_palette = color_palette
  self.http_client = http_client
  self.output = output
  self.reporter_name = reporter_name
end

Public Instance Methods

reporter() click to toggle source
# File lib/dotpretty/options.rb, line 31
def reporter
  return Dotpretty::Reporters::Factory.build_reporter(reporter_name, {
    color_palette: color_palette,
    http_client: http_client,
    output: output
  })

end