Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-workflow.rb

Overview

some core extensions

Instance Method Summary collapse

Instance Method Details

#snake_caseObject



49
50
51
52
53
54
55
# File 'lib/openstudio-workflow.rb', line 49

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