Module: Feet

Defined in:
lib/feet.rb,
lib/feet/view.rb,
lib/feet/utils.rb,
lib/feet/routing.rb,
lib/feet/version.rb,
lib/feet/controller.rb,
lib/feet/file_model.rb,
lib/feet/sqlite_model.rb

Defined Under Namespace

Modules: Model Classes: Application, Controller, Error, RouteObject, View

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.to_snake_case(string) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/feet/utils.rb', line 4

def self.to_snake_case(string)
  string.gsub(/::/, '/') # to remove the subdirectory feature
        .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
        .gsub(/([a-z\d])([A-Z][a-z])/, '\1_\2')
        .tr('-', '_')
        .downcase
end