module StringExtensions

String Extensions

Public Instance Methods

to_rack_name() click to toggle source
# File lib/tshield/extensions/string_extensions.rb, line 5
def to_rack_name
  "HTTP_#{upcase.tr('-', '_')}"
end
underscore() click to toggle source
# File lib/tshield/extensions/string_extensions.rb, line 9
def underscore
  gsub(/::/, '/')
    .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    .gsub(/([a-z\d])([A-Z])/, '\1_\2')
    .tr('-', '_')
    .downcase
end