class Aeolus::CLI::Base

Public Class Methods

headers() click to toggle source
# File lib/aeolus_cli/model/base.rb, line 41
def headers
  if !ENV['LANG'].nil? && ENV['LANG'].size >= 2
    {'ACCEPT_LANGUAGE' => ENV['LANG'][0,2]}
  else
    {}
  end
end
instantiate_collection(collection, prefix_options = {}) click to toggle source
# File lib/aeolus_cli/model/base.rb, line 22
def instantiate_collection(collection, prefix_options = {})
  if collection.is_a?(Hash) && collection.size == 1
    value = collection.values.first
    if value.is_a?(Array)
      value.collect! { |record| instantiate_record(record,prefix_options) }
    else
      [ instantiate_record(value, prefix_options) ]
    end
  elsif collection.is_a?(Hash)
    instantiate_record(collection, prefix_options)
  else
    begin
      collection.collect! { |record| instantiate_record(record, prefix_options) }
    rescue
      []
    end
  end
end

Public Instance Methods

to_s() click to toggle source

Instance Methods

# File lib/aeolus_cli/model/base.rb, line 57
def to_s
  id
end
to_xml(options={}) click to toggle source

Active Resrouce Uses dashes instead of underscores, this method overrides to use underscore

# File lib/aeolus_cli/model/base.rb, line 51
def to_xml(options={})
  options[:dasherize] ||= false
  super({ :root => self.class.element_name }.merge(options))
end