Class: Rtml::ReverseEngineering::Simulator::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/rtml/reverse_engineering/simulator/snapshot.rb

Overview

This class is used to contain a single screen element (an instance of Hpricot::Elem) as well as any variable assignments that have been made. Basically, it is simply used by Rtml::ReverseEngineering::Simulator to check for circular pathways. If two identical snapshots would be created, then it stands to reason that the resultant pathways for those two snapshots will also be identical. If you’re following a path and creating snapshots at every step of the way, and two snapshots match, then using that logic, those two snapshots would indicate a circular pathway. (It comes down to either that, or waiting to catch a stack overflow error, which is less than optimal.)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(screen, variables) ⇒ Snapshot

Returns a new instance of Snapshot.



11
12
13
# File 'lib/rtml/reverse_engineering/simulator/snapshot.rb', line 11

def initialize(screen, variables)
  @screen, @variables = screen, variables.dup
end

Instance Attribute Details

#screenObject (readonly)

Returns the value of attribute screen.



9
10
11
# File 'lib/rtml/reverse_engineering/simulator/snapshot.rb', line 9

def screen
  @screen
end

#variablesObject (readonly)

Returns the value of attribute variables.



9
10
11
# File 'lib/rtml/reverse_engineering/simulator/snapshot.rb', line 9

def variables
  @variables
end

Instance Method Details

#==(other_snapshot) ⇒ Object



15
16
17
# File 'lib/rtml/reverse_engineering/simulator/snapshot.rb', line 15

def ==(other_snapshot)
  @screen == other_snapshot.screen && variables == other_snapshot.variables
end