Sha256: 76066b1b28818777cc3ac3527efc5e3ce4cb97d1280bfd03e23e51c18f32b7b5
Contents?: true
Size: 947 Bytes
Versions: 12
Compression:
Stored size: 947 Bytes
Contents
module Animoto module Support module String # Transforms this string from underscore-form to camel case. Capitalizes # the first letter. # # @example # "this_is_a_underscored_string" # => "ThisIsAUnderscoredString" # # @return [String] the camel case form of this string def camelize self.gsub(/(?:^|_)(.)/) { $1.upcase } end unless "".respond_to?(:camelize) # Transforms this string from camel case to underscore-form. Downcases the # entire string. # # @example # "ThisIsACamelCasedString" # => "this_is_a_camel_cased_string" # # @return [String] the underscored form of this string def underscore self.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase end unless "".respond_to?(:underscore) end end end String.__send__ :include, Animoto::Support::String
Version data entries
12 entries across 12 versions & 1 rubygems