Module: Wings

Defined in:
lib/wings.rb,
lib/wings/util.rb,
lib/wings/view.rb,
lib/wings/routing.rb,
lib/wings/version.rb,
lib/wings/controller.rb,
lib/wings/file_model.rb,
lib/wings/sqlite_model.rb

Defined Under Namespace

Modules: Model Classes: Application, Controller, Route, View

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.to_underscore(string) ⇒ Object



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

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