Class: DataMapper::Model::Hook::ProcCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-core/model/hook.rb

Instance Method Summary collapse

Constructor Details

#initialize(proc) ⇒ ProcCommand

Returns a new instance of ProcCommand.



72
73
74
# File 'lib/dm-core/model/hook.rb', line 72

def initialize(proc)
  @proc = proc.to_proc
end

Instance Method Details

#call(resource) ⇒ Object



76
77
78
# File 'lib/dm-core/model/hook.rb', line 76

def call(resource)
  resource.instance_eval(&@proc)
end

#copy(model) ⇒ Object



80
81
82
# File 'lib/dm-core/model/hook.rb', line 80

def copy(model)
  self
end