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.



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

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

Instance Method Details

#call(resource) ⇒ Object



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

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

#copy(model) ⇒ Object



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

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