Sha256: 18bd7601a3479ef7cade2f9a582deb3f4335f4763e97755acced15dc25bdd510

Contents?: true

Size: 318 Bytes

Versions: 3

Compression:

Stored size: 318 Bytes

Contents

module StratumnSdk
  # We would like to avoid depending on ActiveSupport
  module Helper
    def underscore(string)
      word = string.to_s.dup
      word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
      word.tr!('-', '_')
      word.downcase!
      word
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stratumn_sdk-1.0.0 lib/stratumn_sdk/helper.rb
stratumn_sdk-0.2.0 lib/stratumn_sdk/helper.rb
stratumn_sdk-0.1.0 lib/stratumn_sdk/helper.rb