Class: Naksh::Session
- Inherits:
-
Object
- Object
- Naksh::Session
- Defined in:
- lib/naksh/session.rb
Overview
an a subclass of Array which represents a record of entered scripts
Instance Attribute Summary collapse
-
#history ⇒ Object
Returns the value of attribute history.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
-
#==(other_session) ⇒ Object
two Sessions are == if and only if their history and vars are ==.
- #fork ⇒ Object
-
#initialize(history = History.new, vars = Hash.new) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(history = History.new, vars = Hash.new) ⇒ Session
Returns a new instance of Session.
45 46 47 48 49 50 51 52 |
# File 'lib/naksh/session.rb', line 45 def initialize(history=History.new,vars=Hash.new) @history = history @vars = vars @id=Naksh.sessions.length Naksh.sessions<<self Naksh.current_session=self unless Naksh.current_session super() end |
Instance Attribute Details
#history ⇒ Object
Returns the value of attribute history.
55 56 57 |
# File 'lib/naksh/session.rb', line 55 def history @history end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
56 57 58 |
# File 'lib/naksh/session.rb', line 56 def id @id end |
#vars ⇒ Object
Returns the value of attribute vars.
55 56 57 |
# File 'lib/naksh/session.rb', line 55 def vars @vars end |
Instance Method Details
#==(other_session) ⇒ Object
two Sessions are == if and only if their history and vars are ==
59 60 61 62 63 64 |
# File 'lib/naksh/session.rb', line 59 def == other_session return false unless other_session.kind_of? self.class return false unless other_session.history==history return false unless other_session.vars== vars true end |