diff --git a/lib/parfait/class.rb b/lib/parfait/class.rb index c27ee133..65f4cd2e 100644 --- a/lib/parfait/class.rb +++ b/lib/parfait/class.rb @@ -1,18 +1,14 @@ -# A class describes the capabilities of an object, ie what data it has -# and functions it responds to -# +# Class derives from and derives most of it's functionality (that you would associate with a class) +# from there + +# A Class is a module that can be instantiated + # An Object carries the data for the instance variables it has # The Layout lists the names of the instance variables # The class keeps a list of instance methods, these have a name and code -# The class also keeps a list of class methods (with names+code) -# Class methods are instance methods on the class object - -# So it is essential that the class (the object defining the class) -# can carry methods. It does so as instance variables. -# In fact this property is implemented in the Object, as methods -# may be added to any object at run-time - -class Class < Object +class Class < Module + # ruby 2.1 list (just for reference, keep at bottom) + #:allocate, :new, :superclass end diff --git a/lib/parfait/module.rb b/lib/parfait/module.rb new file mode 100644 index 00000000..2c599f4d --- /dev/null +++ b/lib/parfait/module.rb @@ -0,0 +1,22 @@ + +# A module describes the capabilities of a group of objects, ie what data it has +# and functions it responds to. +# The group may be a Class, but a module may be included into classes and objects too. +# +# The class also keeps a list of class methods (with names+code) +# Class methods are instance methods on the class object + +# So it is essential that the class (the object defining the class) +# can carry methods. It does so as instance variables. +# In fact this property is implemented in the Object, as methods +# may be added to any object at run-time + +class Module + # :<, :<=, :>, :>=, :included_modules, :include?, :name, :ancestors, :instance_methods, :public_instance_methods, + # :protected_instance_methods, :private_instance_methods, :constants, :const_get, :const_set, :const_defined?, + # :const_missing, :class_variables, :remove_class_variable, :class_variable_get, :class_variable_set, + # :class_variable_defined?, :public_constant, :private_constant, :singleton_class?, :include, :prepend, + # :module_exec, :class_exec, :module_eval, :class_eval, :method_defined?, :public_method_defined?, + # :private_method_defined?, :protected_method_defined?, :public_class_method, :private_class_method, :autoload, + # :autoload?, :instance_method, :public_instance_method +end