Sha256: 8dd2de4a36f5339f814010a93318c723a573e9c1c1d1227aff48a419c0888551

Contents?: true

Size: 489 Bytes

Versions: 29

Compression:

Stored size: 489 Bytes

Contents

# typed: true

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.com/terms.html

module Sqreen
  module Dependency
    def self.const_exist?(name)
      resolve_const(name) && true
    rescue NameError, ArgumentError
      false
    end

    def self.resolve_const(name)
      raise ArgumentError if name.nil? || name.empty?

      name.to_s.split('::').inject(Object) { |a, e| a.const_get(e, false) }
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
sqreen-1.22.0-java lib/sqreen/dependency.rb
sqreen-1.22.0 lib/sqreen/dependency.rb
sqreen-1.21.1-java lib/sqreen/dependency.rb
sqreen-1.21.1 lib/sqreen/dependency.rb
sqreen-1.21.0-java lib/sqreen/dependency.rb
sqreen-1.21.0 lib/sqreen/dependency.rb
sqreen-1.20.4-java lib/sqreen/dependency.rb
sqreen-1.20.4 lib/sqreen/dependency.rb
sqreen-1.21.0.beta3-java lib/sqreen/dependency.rb
sqreen-1.21.0.beta3 lib/sqreen/dependency.rb
sqreen-1.20.4.beta1 lib/sqreen/dependency.rb
sqreen-1.19.4 lib/sqreen/dependency.rb
sqreen-1.20.3 lib/sqreen/dependency.rb
sqreen-1.20.2 lib/sqreen/dependency.rb
sqreen-1.21.0.beta2 lib/sqreen/dependency.rb
sqreen-1.21.0.beta1 lib/sqreen/dependency.rb
sqreen-1.20.1-java lib/sqreen/dependency.rb
sqreen-1.20.1 lib/sqreen/dependency.rb
sqreen-1.20.0-java lib/sqreen/dependency.rb
sqreen-1.20.0 lib/sqreen/dependency.rb