Method: Object#param_class!

Defined in:
lib/y_support/core_ext/object/misc.rb

#param_class!(hash, with: (fail ArgumentError, "No parameters!")) ⇒ Object

Constructs parametrized subclasses of the supplied classes and makes them available under specified getters. Expects a hash of pairs { reader_symbol: class }, and a hash of parameters, with which the class(es) is (are) parametrized. Shadows / overwrites existing methods.



46
47
48
49
50
51
52
# File 'lib/y_support/core_ext/object/misc.rb', line 46

def param_class! hash, with: (fail ArgumentError, "No parameters!")
  hash.each { |ß, ç|
    sub = ç.parametrize with
    set_attr_with_readers!( ß => sub )
  }
  return nil
end