Class: Pitchfork::SharedMemory::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/pitchfork/shared_memory.rb

Instance Method Summary collapse

Constructor Details

#initialize(offset) ⇒ Field

Returns a new instance of Field.



33
34
35
36
# File 'lib/pitchfork/shared_memory.rb', line 33

def initialize(offset)
  @drop = PAGES.fetch(offset / MemoryPage::SLOTS)
  @offset = offset % MemoryPage::SLOTS
end

Instance Method Details

#valueObject



38
39
40
# File 'lib/pitchfork/shared_memory.rb', line 38

def value
  @drop[@offset]
end

#value=(value) ⇒ Object



42
43
44
# File 'lib/pitchfork/shared_memory.rb', line 42

def value=(value)
  @drop[@offset] = value
end