Module: Hornsby::Context

Defined in:
lib/hornsby/context.rb

Class Method Summary collapse

Class Method Details

.copy_ivars(to, reload = false) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/hornsby/context.rb', line 7

def self.copy_ivars(to, reload = false)
  instance_variables.each do |iv|
    v = instance_variable_get(iv)
    v.reload if reload and v.respond_to?(:reload)
    to.instance_variable_set(iv, v)
  end
end

.execute(&block) ⇒ Object



3
4
5
# File 'lib/hornsby/context.rb', line 3

def self.execute(&block)
  module_eval(&block) if block
end