Sha256: 3ac313444b6a696a2f1a251d367050ee521bca4fe5a67602e5a0f6486e7e23d0

Contents?: true

Size: 259 Bytes

Versions: 15

Compression:

Stored size: 259 Bytes

Contents

# frozen_string_literal: true

class String
  def camel
    split('_').map { |w| w[0].upcase + w[1..-1] }.join
  end

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

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
bitcoinrb-grpc-0.1.9 lib/extensions/string.rb
bitcoinrb-grpc-0.1.8 lib/extensions/string.rb
bitcoinrb-grpc-0.1.7 lib/extensions/string.rb
bitcoinrb-grpc-0.1.6 lib/extensions/string.rb
bitcoinrb-grpc-0.1.5 lib/extensions/string.rb
lightning-onion-0.2.10 lib/lightning/utils/string.rb
lightning-onion-0.2.9 lib/lightning/utils/string.rb
lightning-onion-0.2.8 lib/lightning/utils/string.rb
lightning-onion-0.2.6 lib/lightning/utils/string.rb
lightning-onion-0.2.5 lib/lightning/utils/string.rb
lightning-onion-0.2.4 lib/lightning/utils/string.rb
lightning-onion-0.2.3 lib/lightning/utils/string.rb
lightning-onion-0.2.2 lib/lightning/utils/string.rb
lightning-onion-0.2.1 lib/lightning/utils/string.rb
lightning-onion-0.2.0 lib/lightning/utils/string.rb