Method: Zookeeper::Exceptions::ZookeeperException.const_missing

Defined in:
lib/zookeeper/exceptions.rb

.const_missing(const) ⇒ Object

NOTE(slyphon): Since 0.4 all of the ZookeeperException subclasses were

defined inside of ZookeeperException, which always seemed well, icky.
if someone references one of these we'll print out a warning and 
then give them the constant


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zookeeper/exceptions.rb', line 31

def self.const_missing(const)
  if Zookeeper::Exceptions.const_defined?(const)

    stacktrace = caller[0..-2].reject {|n| n =~ %r%/rspec/% }.map { |n| "\t#{n}" }.join("\n")

    Zookeeper.deprecation_warning(CONST_MISSING_WARNING % [const.to_s, stacktrace])


    Zookeeper::Exceptions.const_get(const).tap do |const_val|
      self.const_set(const, const_val)
    end
  else
    super
  end
end