Class: Class
- Inherits:
-
Object
- Object
- Class
- Defined in:
- lib/dmorrill10-utils/class.rb
Class Method Summary collapse
Instance Method Summary collapse
- #alias_class_method(alias_method, method_to_alias) ⇒ Object
- #alias_new(alias_of_new) ⇒ Object
- #exceptions(*names) ⇒ Object
Class Method Details
.alias_method_in_singleton_context(alias_method, method_to_alias) ⇒ Object
26 27 28 |
# File 'lib/dmorrill10-utils/class.rb', line 26 def alias_method_in_singleton_context(alias_method, method_to_alias) alias_method alias_method, method_to_alias end |
Instance Method Details
#alias_class_method(alias_method, method_to_alias) ⇒ Object
20 21 22 |
# File 'lib/dmorrill10-utils/class.rb', line 20 def alias_class_method(alias_method, method_to_alias) singleton_class.alias_method_in_singleton_context alias_method.to_sym, method_to_alias.to_sym end |
#alias_new(alias_of_new) ⇒ Object
14 15 16 |
# File 'lib/dmorrill10-utils/class.rb', line 14 def alias_new(alias_of_new) alias_class_method alias_of_new, :new end |
#exceptions(*names) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/dmorrill10-utils/class.rb', line 7 def exceptions(*names) names.each do |name| error_name = name.to_class_name const_set(error_name, Class.new(RuntimeError)) end end |