module Mucks::Config

Attributes

attach[R]
dry_run[R]
list[R]
sessions[R]
verbose[R]

Public Instance Methods

configure(args) click to toggle source
# File lib/mucks/mucks.rb, line 268
def configure(args)
  @params, @sessions = args.partition { |a| a.match(/^-/) }
  @params = @params.reduce('') do |memo, param|
    param = param.gsub(/-/, '')
    memo + param
  end

  set_basic_attributes

  show if self.verbose
end

Private Instance Methods

check_for(flag) click to toggle source
# File lib/mucks/mucks.rb, line 297
def check_for(flag)
  return unless @params
  @params.include?(flag)
end
set_basic_attributes() click to toggle source
# File lib/mucks/mucks.rb, line 282
def set_basic_attributes
  @attach = !check_for('d')
  @verbose = check_for('v')
  @dry_run = check_for('n')
  @list    = check_for('ls')
end
show() click to toggle source
# File lib/mucks/mucks.rb, line 289
def show
  Output.wrap_with('Config') do
    [:attach, :verbose, :dry_run, :list, :sessions].each do |attr|
      puts "#{attr} = #{self.send attr}"
    end
  end
end