class Decorum::DecoratedState

Public Class Methods

new(options={}) click to toggle source
# File lib/decorum/decorated_state.rb, line 3
def initialize(options={})
  @shared_state = Decorum::SharedState.new(options)
end

Public Instance Methods

method_missing(message, *args) click to toggle source

this is one of two areas—the other being loading/unloading of decorators—where i suspect it isn't threadsafe now, but could pretty easily be made to be, e.g., in the writer forwarder below:

lock = Monitor.new
lock.synchronize do
  @state.send(message, *args)
end

more on this some other time.

# File lib/decorum/decorated_state.rb, line 19
def method_missing(message, *args)
  if message =~ /=$/
    # writer, in case we want to do something different here
    @shared_state.send(message, *args)
  else
    # reader
    @shared_state.send(message, *args)
  end
end