Class: OrigenTesters::Charz::Session
- Defined in:
- lib/origen_testers/charz/session.rb
Overview
A charz session contains the final combination of charz object (routines/profiles) and user options to determine how and what charz tests should be created the session should be checked in your interface to determine the current status and can be queried to make charz generation decisions
Instance Attribute Summary collapse
-
#defaults ⇒ Hash
List of values to instantiate the inherited attributes from Profile with if not altered by the session update.
Attributes inherited from Profile
#charz_only, #enables, #flags, #id, #name, #on_result, #placement, #routines
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Session
constructor
A new instance of Session.
-
#pause ⇒ Object
Pauses the current session’s activity while maintaining everthing else about the sessions state.
-
#resume ⇒ Object
Resume activity, if the session is valid.
-
#update(charz_obj, options) ⇒ Object
Takes a Routine or Profile, and queries it to setup the session’s attributes the attributes values can be set from 3 different sources, in order of priority (first is most important): - options - charz object - defaults.
Methods inherited from Profile
#attrs_ok?, #gate_check, #method_missing
Constructor Details
#initialize(options = {}) ⇒ Session
Returns a new instance of Session.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/origen_testers/charz/session.rb', line 11 def initialize( = {}) @id = :current_charz_session @active = false @valid = false if [:defaults] @defaults = [:defaults] else @defaults = { placement: :inline, on_result: nil, enables: nil, flags: nil, name: 'charz', charz_only: false } end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OrigenTesters::Charz::Profile
Instance Attribute Details
#defaults ⇒ Hash
Returns list of values to instantiate the inherited attributes from Profile with if not altered by the session update.
9 10 11 |
# File 'lib/origen_testers/charz/session.rb', line 9 def defaults @defaults end |
Instance Method Details
#pause ⇒ Object
Pauses the current session’s activity while maintaining everthing else about the sessions state
30 31 32 |
# File 'lib/origen_testers/charz/session.rb', line 30 def pause @active = false end |
#resume ⇒ Object
Resume activity, if the session is valid
35 36 37 38 39 |
# File 'lib/origen_testers/charz/session.rb', line 35 def resume if @valid @active = true end end |
#update(charz_obj, options) ⇒ Object
Takes a Routine or Profile, and queries it to setup the session’s attributes the attributes values can be set from 3 different sources, in order of priority (first is most important):
- options
- charz object
- defaults
If the resulting session is invalid, @valid will turn false. Otherwise, the session becomes active
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/origen_testers/charz/session.rb', line 48 def update(charz_obj, ) @valid = false if charz_obj.nil? @active = false @valid = false return @valid end @defined_routines = .delete(:defined_routines) assign_by_priority(:placement, charz_obj, ) assign_by_priority(:on_result, charz_obj, ) assign_by_priority(:enables, charz_obj, ) assign_by_priority(:flags, charz_obj, ) assign_by_priority(:routines, charz_obj, ) assign_by_priority(:name, charz_obj, ) assign_by_priority(:charz_only, charz_obj, ) attrs_ok? massage_gates @active = true @valid = true end |