Sha256: 1240a08debf0f321fceb200ded8dbb1c84f35e2653543b6a0b308c8166a42bac
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
class String def camelize(first_letter_in_uppercase = true) if first_letter_in_uppercase self.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } else self.first + camelize(self)[1..-1] end end def to_pixels Java::com.droiuby.client.core.builder.ActivityBuilder.toPixels(_current_activity, self) end def to_color Java::android.graphics.Color.parseColor(self) end def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end def constantize names = self.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
droiuby-0.2.0 | lib/droiuby/support/string.rb |