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.7.16 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.15 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.14 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.13 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.12 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.11 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.10 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.9 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.5 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.4 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.3 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.2 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.1 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.7.0 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.71 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.70 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.69 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.68 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.67 lib/ruby_app/mixins/class_extension.rb
RubyApp-0.6.66 lib/ruby_app/mixins/class_extension.rb