Sha256: 6355cacd0df462c21d892d6a9ae5328c82cd4bdbbe4d4b398efdfe71a34f38b9
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
module Hazel module Extensions module String def camel_case return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/) altered_self = self.downcase.capitalize altered_self.scan(/[_-][a-zA-Z]/).each do |match| altered_self.gsub!(match, match[1].upcase) end altered_self end def camel_case! self.replace camel_case end def file_name return self.gsub(/-/, "_") if !match(/[A-Z]/) altered_self = self.strip altered_self.scan(/[A-Z]/).each do |match| altered_self.gsub!(match, "_#{match.downcase}") end altered_self.sub(/^_/, "").gsub(/_{2,}+/, "_").downcase end def file_name! self.replace file_name end end end end String.send(:include, Hazel::Extensions::String)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hazel-0.0.3 | lib/extensions/string.rb |
hazel-0.0.2 | lib/extensions/string.rb |