Sha256: 34743e70973bef0ca85cfac69e5aa39d84b2e0df3f855cf13cd8b83aab006a46

Contents?: true

Size: 545 Bytes

Versions: 16

Compression:

Stored size: 545 Bytes

Contents

module OwaspZap
    # extending String instance
    module StringExtension
        # from camel_case to snake_case: ie: fooBar to foo_bar
        def snake_case
          return downcase if match(/\A[A-Z]+\z/)
          gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
          gsub(/([a-z])([A-Z])/, '\1_\2').
          downcase
        end
        # from snake_case to camel_case: ie: foo_bar to fooBar
        def camel_case
          self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
        end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
owasp_zap-0.1.0 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.95 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.94 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.93 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.92 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.91 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.9 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.84 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.83 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.82 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.81 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.8 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.7 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.6 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.5 lib/owasp_zap/string_extension.rb
owasp_zap-0.0.1 lib/owasp_zap/string_extension.rb