Class: DataMapper::Model::Hook::MethodCommand

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

Instance Method Summary collapse

Constructor Details

#initialize(model, method) ⇒ MethodCommand

Returns a new instance of MethodCommand.



86
87
88
# File 'lib/dm-core/model/hook.rb', line 86

def initialize(model, method)
  @model, @method = model, method.to_sym
end

Instance Method Details

#call(resource) ⇒ Object



90
91
92
# File 'lib/dm-core/model/hook.rb', line 90

def call(resource)
  resource.__send__(@method)
end

#copy(model) ⇒ Object



94
95
96
# File 'lib/dm-core/model/hook.rb', line 94

def copy(model)
  self.class.new(model, @method)
end