Class: CSquare::Generator::Enum::OpNamer
- Defined in:
- lib/csquare/generator/enum/op_namer.rb
Direct Known Subclasses
Constant Summary collapse
- OP_TO_SUFFIX =
{ :'<' => 'LT', :'<=' => 'LTE', :'>=' => 'GTE', :'>' => 'GT', :'==' => 'EQEQ', :'!=' => 'NEQ', :'-@' => 'NEG', :'!@' => 'BANG', :'+' => 'ADD', :'-' => 'SUB', :'*' => 'MUL', :'/' => 'DIV', :'%' => 'MOD', :'&' => 'AND', :'|' => 'OR', :'^' => 'XOR', :'<<' => 'LSH', :'>>' => 'RSH', :'~' => 'NOT' }
Instance Method Summary collapse
- #name(op_symbol) ⇒ Object
-
#num(op_symbol) ⇒ Object
Use the character values if operations are single-character.
Methods inherited from Namer
Constructor Details
This class inherits a constructor from CSquare::Generator::Enum::Namer
Instance Method Details
#name(op_symbol) ⇒ Object
24 25 26 |
# File 'lib/csquare/generator/enum/op_namer.rb', line 24 def name op_symbol OP_TO_SUFFIX.has_key?(op_symbol) ? super(OP_TO_SUFFIX[op_symbol]) : nil end |
#num(op_symbol) ⇒ Object
Use the character values if operations are single-character
29 30 31 32 |
# File 'lib/csquare/generator/enum/op_namer.rb', line 29 def num op_symbol op_string = op_symbol.to_s op_string.size == 1 ? op_string.ord : :auto end |