Class: CRStruct::Registered
Instance Method Summary collapse
- #define_singleton_method(k, &blk) ⇒ Object
-
#initialize(*keys) ⇒ Registered
constructor
A new instance of Registered.
Methods inherited from Open
Constructor Details
#initialize(*keys) ⇒ Registered
Returns a new instance of Registered.
13 14 15 |
# File 'lib/crstruct.rb', line 13 def initialize(*keys) @keys = keys end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CRStruct::Open
Instance Method Details
#define_singleton_method(k, &blk) ⇒ Object
17 18 19 20 |
# File 'lib/crstruct.rb', line 17 def define_singleton_method(k,&blk) raise KeyError, "can't add unregistered key: :#{k}" unless @keys.include? k super(k,&blk) end |