Sha256: a7faf3db7f530214692570fd1901bf28b04d61f751026e115e97b76732d37f9a

Contents?: true

Size: 442 Bytes

Versions: 125

Compression:

Stored size: 442 Bytes

Contents

module RubyApp

  module Mixins

    module ClassExtension

      def short_name
        return self.to_s.split('::').last
      end

      def class_name
        name = self.to_s
        name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
        name.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
        name.gsub!(/(::)/,'_')
        name.downcase!
        return name
      end

    end

  end

end

class Class
  include RubyApp::Mixins::ClassExtension
end

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
RubyApp-0.5.59 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.58 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.57 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.56 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.55 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.54 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.53 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.52 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.51 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.50 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.49 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.48 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.47 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.46 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.45 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.44 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.43 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.42 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.41 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.5.40 lib/ruby_app/mixins/class_extension.rb