Sha256: a06d191dd3d197dad59fd96547b2d1cec6ba90d69b24291a9387a2c82a91c2ff
Contents?: true
Size: 518 Bytes
Versions: 1
Compression:
Stored size: 518 Bytes
Contents
class Object def blank? respond_to?(:empty?) ? !!empty? : !self end def present? !blank? end end class String def to_camel method = nil case method when nil return self.split(/_/).map(&:capitalize).join if method == nil when :lower return self.split(/_/)[0] + self.split(/_/)[1..-1].map(&:capitalize).join if method == :lower end end def to_snake self.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .downcase end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
justa-ruby-0.1.9 | lib/justa/core_ext.rb |