Sha256: 8f3f50b18b8e1c86c98767d4590c39a00e381a429b10ea1805e31b60b5411ad5
Contents?: true
Size: 657 Bytes
Versions: 1
Compression:
Stored size: 657 Bytes
Contents
class String def integer? self =~ /\A[-+]?[0-9]+\z/ end def to_snake_case gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .gsub(/\s/, '_') .gsub(/__+/, '_') .downcase end def to_camel_case return self if self !~ /_/ && self =~ /[A-Z]+.*/ split('_').map(&:capitalize).join end def uncapitalize self[0, 1].downcase + self[1..-1] end def to_camel_back to_camel_case.uncapitalize end def to_bool return false if self =~ (/^(false)$/i) return true if self =~ (/^(true)$/i) fail "invalid value for Boolean: \"#{self}\"" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-cloud-core-0.1.0 | lib/rspec/cloud/core/ext.rb |