Module: Enumeration

Included in:
ZooKeeper::Error, ZooKeeper::KeeperState, ZooKeeper::Perms, ZooKeeper::WatchEvent
Defined in:
lib/zkruby/enum.rb

Overview

Including in a class and us the “enum” DSL method to create class instances As a special case, if the including class is descendant from StandardError, the enumerated instances will be classes descendent from the including class (eg like Errno)

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
# File 'lib/zkruby/enum.rb', line 7

def self.included(base)
    base.extend(ClassMethods)
    #  In the normal case we just include our methods in the base class
    #  but for Errors we need to include them on each instance
    base.send :include,InstanceMethods unless base < StandardError
end