Sha256: 95a02bc5fa4c2f33e93f6ab8eb7713a6068055af58abf2963b9ef01fed60cfae

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

# Parses the configuration information and puts it into options
def parse_config!(options)
  config = YAML.load_file File.expand_path(options[:config])
  provider = (options[:provider] ||= config['default'] || config.first.first)
  if provider and provider.length > 0
    options[:project] ||= config[provider]['project']
    options[:authentication] ||= config[provider]['authentication']
  end
  options
end

# A utility method used to separate name:value pairs
def attributes_hash(kvlist)
  if kvlist.is_a?(String)
    kvlist.split(',').reduce({}) do |mem, kv|
      key, value = kv.split(':')
      mem[key] = value
      mem
    end
  elsif kvlist.is_a?(Array)
    mem = {}
    kvlist.each_slice(2) do |k, v|
      mem[k] = v
    end
    mem
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ticketmaster-0.3.2 lib/ticketmaster/cli/common.rb
ticketmaster-0.3.1 lib/ticketmaster/cli/common.rb