Class: Chozo::CleanRoomBase

Inherits:
Object show all
Defined in:
lib/chozo/clean_room_base.rb

Overview

Author:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(real_model) ⇒ CleanRoomBase

Returns a new instance of CleanRoomBase.



18
19
20
21
# File 'lib/chozo/clean_room_base.rb', line 18

def initialize(real_model)
  @real_model = real_model
  @noisy      = real_model.class.noisy_clean_room
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object (private)



32
33
34
# File 'lib/chozo/clean_room_base.rb', line 32

def method_missing(*args)
  noisy ? super : nil
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)


9
10
11
12
13
14
15
# File 'lib/chozo/clean_room_base.rb', line 9

def dsl_attr_writer(attribute)
  class_eval do
    define_method(attribute) do |value|
      set_attribute(attribute, value)
    end
  end
end