Parent

Class/Module Index [+]

Quicksearch

HammerCLI::Output::Output

Attributes

default_adapter[RW]

Public Class Methods

adapters() click to toggle source
# File lib/hammer_cli/output/output.rb, line 41
def self.adapters
  @adapters_hash ||= {}
  @adapters_hash
end
formatters() click to toggle source
# File lib/hammer_cli/output/output.rb, line 46
def self.formatters
  @formatters_hash ||= {}
  @formatters_hash
end
new(context={}, options={}) click to toggle source
# File lib/hammer_cli/output/output.rb, line 4
def initialize(context={}, options={})
  self.context = context
  self.default_adapter = options[:default_adapter]
end
register_adapter(name, adapter_class) click to toggle source
# File lib/hammer_cli/output/output.rb, line 51
def self.register_adapter(name, adapter_class)
  adapters[name] = adapter_class
end
register_formatter(formatter, *field_types) click to toggle source
# File lib/hammer_cli/output/output.rb, line 55
def self.register_formatter(formatter, *field_types)
  field_types.each do |type|
    formatter_list = formatters[type] || []
    formatter_list << formatter
    formatters[type] = formatter_list
  end
end

Public Instance Methods

adapter() click to toggle source
# File lib/hammer_cli/output/output.rb, line 30
def adapter
  adapter_name = context[:adapter] || default_adapter

  begin
    init_adapter(adapter_name.to_sym)
  rescue NameError
    Logging.logger[self.class.name].warn("Required adapter '#{adapter_name}' was not found, using 'base' instead")
    init_adapter(:base)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.