Class: Pallets::Context

Inherits:
Hash
  • Object
show all
Defined in:
lib/pallets/context.rb

Overview

Hash-like class that additionally holds a buffer for all write operations that occur after initialization

Instance Method Summary collapse

Instance Method Details

#[]=(key, value) ⇒ Object



5
6
7
8
# File 'lib/pallets/context.rb', line 5

def []=(key, value)
  buffer[key] = value
  super
end

#bufferObject



15
16
17
# File 'lib/pallets/context.rb', line 15

def buffer
  @buffer ||= {}
end

#merge!(other_hash) ⇒ Object



10
11
12
13
# File 'lib/pallets/context.rb', line 10

def merge!(other_hash)
  buffer.merge!(other_hash)
  super
end