class MotherBrain::CleanRoomBase

Attributes

real_model[R]

Public Class Methods

dsl_attr_writer(attribute) click to toggle source

Create a DSL writer function that will assign the a given value to the real object of this clean room.

@param [Symbol] attribute

# File lib/mb/clean_room_base.rb, line 8
def dsl_attr_writer(attribute)
  class_eval do
    define_method(attribute) do |value|
      set_attribute(attribute, value)
    end
  end
end
new(real_model, &block) click to toggle source

@param [Object] real_model

# File lib/mb/clean_room_base.rb, line 20
def initialize(real_model, &block)
  @real_model = real_model
end

Private Instance Methods

method_missing(method_name, *args, &block) click to toggle source
# File lib/mb/clean_room_base.rb, line 32
def method_missing(method_name, *args, &block)
  ErrorHandler.wrap PluginSyntaxError,
    backtrace: caller,
    method_name: method_name,
    text: "'#{method_name}' is not a valid keyword"
end
set_attribute(name, value) click to toggle source
# File lib/mb/clean_room_base.rb, line 28
def set_attribute(name, value)
  real_model.send("#{name}=", value)
end