Module: TypeCollection::Base::BaseClassMethods
- Defined in:
- lib/typecollection/base.rb
Instance Method Summary collapse
-
#all_type_names ⇒ Object
Returns all of the known subclass names for this collection.
-
#all_types ⇒ Object
Returns all of the known subclasses for this collection.
-
#get_associated_type(associate) ⇒ Object
Get similar type based on the object passed in which can be a String, Object (using the inferred type), or Class.
-
#get_type(type) ⇒ Object
Gets the type associated with the provided value (Class or Otherwise).
Instance Method Details
#all_type_names ⇒ Object
Returns all of the known subclass names for this collection
6 |
# File 'lib/typecollection/base.rb', line 6 def all_type_names(); return __tc_members().keys(); end |
#all_types ⇒ Object
Returns all of the known subclasses for this collection
8 |
# File 'lib/typecollection/base.rb', line 8 def all_types(); return __tc_members().values(); end |
#get_associated_type(associate) ⇒ Object
Get similar type based on the object passed in which can be a String, Object (using the inferred type), or Class
18 19 20 21 22 23 24 25 26 |
# File 'lib/typecollection/base.rb', line 18 def get_associated_type(associate) if (!associate.kind_of?(String)) if (!associate.kind_of?(Class)) associate = associate.class end associate = associate.inferred_type() end return self.get_type(associate) end |
#get_type(type) ⇒ Object
Gets the type associated with the provided value (Class or Otherwise)
10 11 12 13 14 15 |
# File 'lib/typecollection/base.rb', line 10 def get_type(type) type = type.inferred_type() if (type.kind_of?(Class)) mems = __tc_members() raise TypeCollection::UnknownChildType.new() unless (mems.has_key?(type)) return mems[type] end |