Class: Fix::Expectation

Inherits:
Object
  • Object
show all
Includes:
Spectus::DSL
Defined in:
lib/fix/expectation.rb

Direct Known Subclasses

ExpectationHigh

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, positive, definition, *args) ⇒ Expectation

Returns a new instance of Expectation.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fix/expectation.rb', line 12

def initialize object, positive, definition, *args
  @positive   = positive
  @definition = definition
  @args       = args
  @priority   = DB.instance.random.rand

  freeze

  DB.instance.update(object => SortedSet[]) unless DB.instance.key? object
  DB.instance.fetch(object).add self
end

Instance Attribute Details

#priorityObject (readonly)

Returns the value of attribute priority.



10
11
12
# File 'lib/fix/expectation.rb', line 10

def priority
  @priority
end

Instance Method Details

#<=>(other) ⇒ Object



24
25
26
# File 'lib/fix/expectation.rb', line 24

def <=> other
  self.priority <=> other.priority
end