Module: Chozo::CleanRoom

Defined in:
lib/chozo/clean_room.rb

Overview

Author:

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fabricate(klass) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/chozo/clean_room.rb', line 60

def fabricate(klass)
  Class.new(CleanRoomBase) do
    klass.attributes.each do |name, _|
      dsl_attr_writer name.to_sym
    end
  end
end

.included(base) ⇒ Object



55
56
57
58
# File 'lib/chozo/clean_room.rb', line 55

def included(base)
  base.extend(ClassMethods)
  base.send(:include, Chozo::VariaModel)
end

Instance Method Details

#clean_eval(*args, &block) ⇒ Object

Parameters:

  • data (String, Proc)


70
71
72
73
74
75
76
77
# File 'lib/chozo/clean_room.rb', line 70

def clean_eval(*args, &block)
  data = args.shift
  unless data.nil?
    block = data.is_a?(Proc) ? data : proc { eval(data, binding, *args) }
  end

  self.class.clean_room.new(self).instance_eval(&block)
end