Sha256: ebfe4437e688591d6b3bc703e9a28ad650321b9edff030483a432d820775f5a0

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 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)
  require 'enumerator' if RUBY_VERSION < "1.8.7"
  if kvlist.is_a?(String)
    kvlist.split(',').inject({}) 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

3 entries across 3 versions & 1 rubygems

Version Path
ticketmaster-0.3.6 lib/ticketmaster/cli/common.rb
ticketmaster-0.3.4 lib/ticketmaster/cli/common.rb
ticketmaster-0.3.3 lib/ticketmaster/cli/common.rb