class KBuilder::Commands::BaseCommand

Base command for single responsibility actions that can be fired from methods in the builder.

Uses the command pattern

Attributes

builder[RW]
valid[RW]

Public Class Methods

new(**opts) click to toggle source
# File lib/k_builder/commands/base_command.rb, line 15
def initialize(**opts)
  @builder = opts[:builder]
  @valid = true
end

Public Instance Methods

debug(title: nil) click to toggle source
# File lib/k_builder/commands/base_command.rb, line 30
def debug(title: nil)
  log.section_heading(title) if title
  debug_values if respond_to?(:debug_values)
end
guard(message) click to toggle source
# File lib/k_builder/commands/base_command.rb, line 20
def guard(message)
  # THIS SHOULD ONLY LOG IF DEBUGGING IS TURNED ON
  log.error(message)
  @valid = false
end
valid?() click to toggle source
# File lib/k_builder/commands/base_command.rb, line 26
def valid?
  @valid
end