Class: Enum::Enumeration

Inherits:
Object
  • Object
show all
Defined in:
lib/enum.rb

Overview

use the Enumeration class to constrain the scope of where the Enum definition can take place.

Instance Method Summary collapse

Constructor Details

#initialize(parent, *args, &block) ⇒ Enumeration

Returns a new instance of Enumeration.



122
123
124
125
# File 'lib/enum.rb', line 122

def initialize parent, *args, &block
  @parent = parent
  instance_eval(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (protected)



127
128
129
# File 'lib/enum.rb', line 127

def method_missing *args, &block
  @parent.send :add_enum, *args, &block
end