class Branchtree::Commands::Common

Public Instance Methods

execute() click to toggle source
# File lib/branchtree/commands/common.rb, line 34
def execute
  if params[:help]
    puts help
    exit 0
  end

  if params[:loglevel]
    logger.log_at(params[:loglevel].to_sym)
    logger.debug "Logging at level #{params[:loglevel]}."
  end
end
load_situation() click to toggle source
# File lib/branchtree/commands/common.rb, line 46
def load_situation
  Situation.new.tap(&:read)
end
load_tree() click to toggle source
# File lib/branchtree/commands/common.rb, line 50
def load_tree
  logger.debug "Loading mapfile from #{params[:mapfile]}."
  Tree.load(params[:mapfile])
end
pluralize(quantity, word, plural: " click to toggle source
# File lib/branchtree/commands/common.rb, line 55
def pluralize(quantity, word, plural: "#{word}s")
  if quantity == 1
    "1 #{word}"
  else
    "#{quantity} #{plural}"
  end
end