Class: Nauvisian::CLI::Lister

Inherits:
Object
  • Object
show all
Defined in:
lib/nauvisian/cli/lister.rb

Direct Known Subclasses

CSV, Gfm, Json, Plain

Defined Under Namespace

Classes: CSV, Gfm, Json, Plain

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ Lister

Returns a new instance of Lister.



27
28
29
# File 'lib/nauvisian/cli/lister.rb', line 27

def initialize(headers)
  @headers = headers
end

Class Method Details

.allObject



15
16
17
# File 'lib/nauvisian/cli/lister.rb', line 15

def self.all
  @listers.keys.sort
end

.for(format) ⇒ Object



11
12
13
# File 'lib/nauvisian/cli/lister.rb', line 11

def self.for(format)
  @listers.fetch(format)
end

.inherited(subclass) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/nauvisian/cli/lister.rb', line 19

def self.inherited(subclass)
  demodulized = Nauvisian.inflector.demodulize(subclass.name)
  underscored = Nauvisian.inflector.underscore(demodulized)
  @listers[underscored.to_sym] = subclass

  super
end