Sha256: d30b36069f4c438bc6d6ef50a5447c1ff86718ec7d3cea860ba6e7212c6a3578

Contents?: true

Size: 332 Bytes

Versions: 1

Compression:

Stored size: 332 Bytes

Contents

module Anyway
  module Ext
    # Extend String through refinements
    module Class
      refine ::Class do
        def underscore_name
          return unless name
          word = name[/^(\w+)/]
          word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
          word.downcase!
          word
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anyway_config-0.5.1 lib/anyway/ext/class.rb