Sha256: 66fd9361ccb3a4aad7eb4541d24b1deab8c98a2352f8611de55b81c1bc2ac8ce

Contents?: true

Size: 407 Bytes

Versions: 9

Compression:

Stored size: 407 Bytes

Contents

module Antlr4Native
  module StringHelpers
    def capitalize(str)
      str.sub(/\A(.)/) { $1.upcase }
    end

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

    def dasherize(str)
      underscore(str).gsub('_', '-')
    end
  end

  StringHelpers.extend(StringHelpers)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
antlr4-native-2.2.1 lib/antlr4-native/string_helpers.rb
antlr4-native-2.2.0 lib/antlr4-native/string_helpers.rb
antlr4-native-2.1.0 lib/antlr4-native/string_helpers.rb
antlr4-native-2.0.1 lib/antlr4-native/string_helpers.rb
antlr4-native-2.0.0 lib/antlr4-native/string_helpers.rb
antlr4-native-1.1.0 lib/antlr4-native/string_helpers.rb
antlr4-native-1.0.2 lib/antlr4-native/string_helpers.rb
antlr4-native-1.0.1 lib/antlr4-native/string_helpers.rb
antlr4-native-1.0.0 lib/antlr4-native/string_helpers.rb