Class: IV::CLI::Formatter::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::Errors, Helpers::SubclassRegistration
Defined in:
lib/iv-cli/formatters/base.rb

Direct Known Subclasses

CSV, Table

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::SubclassRegistration

included

Methods included from Helpers::Errors

included

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



11
12
13
# File 'lib/iv-cli/formatters/base.rb', line 11

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/iv-cli/formatters/base.rb', line 9

def options
  @options
end

Class Method Details

.find(formatter_type) ⇒ Object



15
16
17
18
# File 'lib/iv-cli/formatters/base.rb', line 15

def self.find(formatter_type)
  fail(4, %|Unable to find formatter for #{formatter_type}|) unless subclasses.include?(formatter_type)
  subclasses[formatter_type]
end

Instance Method Details

#output_rows(*args) ⇒ Object



20
21
22
23
# File 'lib/iv-cli/formatters/base.rb', line 20

def output_rows(*args)
  #abstract method
  raise "Abstract method called on IV::CLI::Formatter"
end