Class: Qfill::Strategy::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/qfill/strategy/base.rb

Direct Known Subclasses

DrainToEmpty, DrainToLimit, Sample

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manager) ⇒ Base

Returns a new instance of Base.



23
24
25
26
27
28
# File 'lib/qfill/strategy/base.rb', line 23

def initialize(manager)
  @manager = manager
  @added = 0
  @tally = 0
  @ratio_modifier = 1
end

Instance Attribute Details

#addedObject

Returns the value of attribute added.



19
20
21
# File 'lib/qfill/strategy/base.rb', line 19

def added
  @added
end

#ratio_modifierObject

Returns the value of attribute ratio_modifier.



19
20
21
# File 'lib/qfill/strategy/base.rb', line 19

def ratio_modifier
  @ratio_modifier
end

#tallyObject

Returns the value of attribute tally.



19
20
21
# File 'lib/qfill/strategy/base.rb', line 19

def tally
  @tally
end

Instance Method Details

#bump!Object



55
56
57
58
# File 'lib/qfill/strategy/base.rb', line 55

def bump!
  self.tally += added
  self.fill_count += added
end

#default_pusherObject



51
52
53
# File 'lib/qfill/strategy/base.rb', line 51

def default_pusher
  # NOOP
end

#fill_according_to_list_ratios!Object

Go through the queues this result should be filled from and push elements from them onto the current result list.

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/qfill/strategy/base.rb', line 43

def fill_according_to_list_ratios!
  raise NotImplementedError
end

#fill_to_ratio!Object

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/qfill/strategy/base.rb', line 38

def fill_to_ratio!
  raise NotImplementedError
end

#fill_up_to_ratio!Object

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/qfill/strategy/base.rb', line 47

def fill_up_to_ratio!
  raise NotImplementedError
end

#nameObject



30
31
32
# File 'lib/qfill/strategy/base.rb', line 30

def name
  NAME
end

#on_fill!Object

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/qfill/strategy/base.rb', line 34

def on_fill!
  raise NotImplementedError
end

#remainingObject



60
61
62
# File 'lib/qfill/strategy/base.rb', line 60

def remaining
  all_list_max - fill_count
end