Class: MotherBrain::CleanRoomBase

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/mb/clean_room_base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

add_argument_header, dev, filename, #log_exception, logger, #logger, reset, set_logger, setup

Constructor Details

#initialize(real_model, &block) ⇒ CleanRoomBase

Returns a new instance of CleanRoomBase.

Parameters:

  • real_model (Object)


20
21
22
# File 'lib/mb/clean_room_base.rb', line 20

def initialize(real_model, &block)
  @real_model = real_model
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



32
33
34
35
36
37
# 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

Class Method Details

.dsl_attr_writer(attribute) ⇒ Object

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

Parameters:

  • attribute (Symbol)


8
9
10
11
12
13
14
# 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