Sha256: f1e9cbe78b438c1f8469e56cca1dfd011996b358e243be787bb5e4e8cdb61cf6

Contents?: true

Size: 574 Bytes

Versions: 8

Compression:

Stored size: 574 Bytes

Contents

class CoreExt
  def self.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
end

class String
  def constantize
    CoreExt.constantize(self)
  end

  def ends_with?(patt)
    patt = Regexp.new(Regexp.escape(patt) + "$")
    self.match patt
  end
end

class Array
  def all_true?
    self.all? {|o| o == true}
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
checker-0.6.4 lib/checker/core_ext.rb
checker-0.6.3 lib/checker/core_ext.rb
checker-0.6.2 lib/checker/core_ext.rb
checker-0.6.1 lib/checker/core_ext.rb
checker-0.0.6 lib/checker/core_ext.rb
checker-0.0.5 lib/checker/core_ext.rb
checker-0.0.4.2 lib/checker/core_ext.rb
checker-0.0.4.1 lib/checker/core_ext.rb