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.


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

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

Instance Method Details

#call(resource) ⇒ Object


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

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

#copy(model) ⇒ Object


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

def copy(model)
  self
end