class AMEE::DataAbstraction::TermsList
Class
extending the Array and providing specific attributes and methods for operating on a collection of instances of the class Term.
Constants
- Selectors
- TermClasses
Subclasses of the Term class which
self
can contain.Each subclass symbol also represents a dynamically generated method name for
self
which can be called to return a newTermsList
instance containing that subset of terms only, e.g.,my_terms_list.inputs #=> <AMEE::DataAbstraction::TermsList ... > my_terms_list.profiles #=> <AMEE::DataAbstraction::TermsList ... >
These methods can be compounded:
my_terms_list.inputs.drills #=> <AMEE::DataAbstraction::TermsList ... > my_terms_list.profiles.visible #=> <AMEE::DataAbstraction::TermsList ... >
- TermFlags
Boolean attributes of instances of the Term class.
Each attribute symbol also represents a dynamically generated method name for
self
which can be called to return a newTermsList
instance containing that subset of only those terms for which the attribute is true, e.g.,my_terms_list.visible #=> <AMEE::DataAbstraction::TermsList ... > my_terms_list.set #=> <AMEE::DataAbstraction::TermsList ... >
These methods can be compounded:
my_terms_list.drills.visible.set #=> <AMEE::DataAbstraction::TermsList ... >
- TermProperties
Attributes of the class <i>Term</tt>.
Each attribute symbol also defines a dynamically generated method which return arrays of the values of the named attribute for all terms, e.g.,
my_terms_list.labels => [ :type, :fuel, :distance, :co2 ... ] my_terms_list.values => [ 'van;, 'petrol', 500, 25.4 ... ]
Public Instance Methods
Return a new TermsList
instance containing that subset of terms which occur after the term labeled label
in the owning calculation
# File lib/amee-data-abstraction/terms_list.rb, line 74 def after(label) self.class.new select{|x|x.after?(label)} end
Return a new TermsList
instance containing that subset of terms which occur before the term labeled label
in the owning calculation
# File lib/amee-data-abstraction/terms_list.rb, line 66 def before(label) self.class.new select{|x|x.before?(label)} end
Return a new TermsList
instance containing that subset of terms which are compulsory in the owning calculation.
If no argument is provided, the compulsory status of each term is defined according to the current usage of the parent caluclation. Otherwise, compulsory status is determined on the basis of the usage whose AMEE
platform path matches usage
# File lib/amee-data-abstraction/terms_list.rb, line 98 def compulsory(usage=nil) self.class.new select{|x|x.compulsory?(usage)} end
Return a new TermsList
instance containing that subset of terms which are either compulsory OR optional in the owning calculation, i.e. any which are NOT forbidden.
If no argument is provided, the optional/compulsory status of each term is defined according to the current usage of the parent caluclation. Otherwise, optional/compulsory status is determined on the basis of the usage whose AMEE
platform path matches usage
# File lib/amee-data-abstraction/terms_list.rb, line 111 def in_use(usage=nil) self.class.new select{|x|x.in_use?(usage)} end
Return a new TermsList
instance containing that subset of terms which are optional in the owning calculation.
If no argument is provided, the optional status of each term is defined according to the current usage of the parent caluclation. Otherwise, optional status is determined on the basis of the usage whose AMEE
platform path matches usage
# File lib/amee-data-abstraction/terms_list.rb, line 86 def optional(usage=nil) self.class.new select{|x|x.optional?(usage)} end
Return a new TermsList
instance containing that subset of terms which are neither compulsory OR optional in the owning calculation, i.e. those which are forbidden.
If no argument is provided, the forbidden status of each term is defined according to the current usage of the parent caluclation. Otherwise, forbidden status is determined on the basis of the usage whose AMEE
platform path matches usage
# File lib/amee-data-abstraction/terms_list.rb, line 124 def out_of_use(usage=nil) self.class.new select{|x|x.out_of_use?(usage)} end