Module: Sinatra::ParamValidator::SnakeCase

Included in:
Sinatra::ParamValidator
Defined in:
lib/sinatra/param_validator/snake_case.rb

Overview

Helpers for validating parameters

Instance Method Summary collapse

Instance Method Details

#snake_case(string) ⇒ Object



7
8
9
# File 'lib/sinatra/param_validator/snake_case.rb', line 7

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