Class: CSquare::Generator::Enum::Namer

Inherits:
Object
  • Object
show all
Defined in:
lib/csquare/generator/enum/namer.rb

Direct Known Subclasses

OpNamer

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ Namer

Returns a new instance of Namer.



2
3
4
# File 'lib/csquare/generator/enum/namer.rb', line 2

def initialize prefix
  @prefix = prefix
end

Instance Method Details

#name(arg) ⇒ Object



6
7
8
# File 'lib/csquare/generator/enum/namer.rb', line 6

def name arg
  @prefix.nil? ? arg.to_s.upcase : "#{@prefix.upcase}_#{arg.to_s.upcase}"
end

#num(arg) ⇒ Object



10
11
12
# File 'lib/csquare/generator/enum/namer.rb', line 10

def num arg
  :auto
end