Class: BELParser::Language::Version2_0::ReturnTypes::Any
- Inherits:
-
Object
- Object
- BELParser::Language::Version2_0::ReturnTypes::Any
- Defined in:
- lib/bel_parser/language/version2_0/return_types/any.rb
Overview
The any type.
Direct Known Subclasses
Abundance, Activity, BiologicalProcess, Fragment, Fusion, List, Location, MolecularActivity, Products, ProteinModification, Reactants, Variant
Class Method Summary collapse
-
.inherited(cls) ⇒ Object
Inherited hook overridden to keep track of descendants.
-
.raise_not_implemented(method) ⇒ Object
Raise NotImplementedError for
method
. -
.subtype_of?(other_return_type) ⇒ Boolean
Returns
true
if I am a subtype ofother_return_type
; otherwise returnfalse
. -
.subtypes ⇒ Array<Class>
Retrieve my immediate subtypes.
-
.to_sym ⇒ Object
Return the Symbol value.
-
.transitive_subtypes ⇒ Array<Class>
Retrieve my transitive subtypes.
Class Method Details
.inherited(cls) ⇒ Object
Inherited hook overridden to keep track of descendants. This method is inherited by all descendants.
50 51 52 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 50 def self.inherited(cls) (@subtypes ||= []) << cls end |
.raise_not_implemented(method) ⇒ Object
Raise NotImplementedError for method
. Alters the exception backtrace to exclude this method.
60 61 62 63 64 65 66 67 68 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 60 def self.raise_not_implemented(method) msg = "#{name} must implement the #{method} method" raise NotImplementedError, msg rescue StandardError raise( $ERROR_INFO.class, $ERROR_INFO., $ERROR_INFO.backtrace[1..-1]) end |
.subtype_of?(other_return_type) ⇒ Boolean
Returns true
if I am a subtype of other_return_type
; otherwise return false
.
22 23 24 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 22 def self.subtype_of?(other_return_type) self <= other_return_type end |
.subtypes ⇒ Array<Class>
Retrieve my immediate subtypes.
29 30 31 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 29 def self.subtypes (@subtypes ||= []).freeze end |
.to_sym ⇒ Object
This method should be overridden in subclasses.
Return the Symbol value.
12 13 14 15 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 12 def self.to_sym raise_not_implemented(__method__) if self != Any :* end |
.transitive_subtypes ⇒ Array<Class>
Retrieve my transitive subtypes.
36 37 38 39 40 41 42 43 |
# File 'lib/bel_parser/language/version2_0/return_types/any.rb', line 36 def self.transitive_subtypes transitive_subtypes = (@subtypes ||= []).flat_map do |subtype| [subtype, subtype.subtypes] end.flatten transitive_subtypes << self transitive_subtypes.freeze end |