Sha256: 25d650f7fd52c8d567c40dc4a8db63a8d351289630aa6f995be22f55ed256756

Contents?: true

Size: 380 Bytes

Versions: 4

Compression:

Stored size: 380 Bytes

Contents

# http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-constantize
def constantize(camel_cased_word)
  names = camel_cased_word.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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-conform-1.3.0 lib/ext/inflections.rb
git-conform-1.2.1 lib/ext/inflections.rb
git-conform-1.1.0 lib/ext/inflections.rb
git-conform-1.0.0 lib/ext/inflections.rb