Class: Jeth::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/jeth/util.rb

Class Method Summary collapse

Class Method Details

.int_to_hex(n) ⇒ Object



11
12
13
# File 'lib/jeth/util.rb', line 11

def self.int_to_hex(n)
  "0x#{n.to_s(16)}"
end

.underscore(s) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/jeth/util.rb', line 3

def self.underscore(s)
  s.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("-", "_").
  downcase
end