Sha256: 252b880f3076b8cf96783d6bd19b3267687f0f1db945a1681e401b6f3b61564a

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

module Extensible
  ##
  # Utils contains utility methods whose implementation depends on the currently used Ruby version.
  module Utils
    class << self
      if RUBY_VERSION >= "1.9".freeze
        ##
        # call-seq:
        #   own_const_defined?(mod, const_name) => true or false
        #
        # Returns +true+ if constant +const_name+ has been defined in module +mod+ (and not in one of its ancestors).
        # Returns +false+ otherwise.
        def own_const_defined?(mod, const_name)
          mod.const_defined?(const_name, false)
        end
      else
        # :nocov:
        def own_const_defined?(mod, const_name)
          mod.const_defined?(const_name)
        end
        # :nocov:
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
extensible-0.1.3 lib/extensible/utils.rb
extensible-0.1.2 lib/extensible/utils.rb
extensible-0.1.1 lib/extensible/utils.rb
extensible-0.1.0 lib/extensible/utils.rb
extensible-0.0.5 lib/extensible/utils.rb