Module: Modspace
- Defined in:
- lib/modspace.rb,
lib/modspace/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.def_mod(*args, in_namespace: Object, in_class_of_instance: nil) ⇒ Object
Note: We use the term “namespace” to mean “class” or “module”.
Class Method Details
.def_mod(*args, in_namespace: Object, in_class_of_instance: nil) ⇒ Object
Note: We use the term “namespace” to mean “class” or “module”. The term abstracts away the differences for our purposes.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/modspace.rb', line 12 def def_mod(*args, in_namespace: Object, in_class_of_instance: nil) normalised_args = (args) parent_namespace = if !in_class_of_instance.nil? in_class_of_instance.class elsif !in_namespace.nil? # :in_namespace can be a module or class in_namespace else raise ArgumentError, "If in_class or for_instance non-nil is specified they must be non-nil." end defp_class_mod(parent_namespace, *normalised_args) end |