Sha256: 8295954522cc22ae28c6e2bcb3e4f931e1d1487b0d639d3a4ddeddaf98c88fe0

Contents?: true

Size: 599 Bytes

Versions: 4

Compression:

Stored size: 599 Bytes

Contents

require 'checker/utils'

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

4 entries across 4 versions & 1 rubygems

Version Path
checker-0.0.4 lib/checker/core_ext.rb
checker-0.0.3 lib/checker/core_ext.rb
checker-0.0.2 lib/checker/core_ext.rb
checker-0.0.1 lib/checker/core_ext.rb