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.


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

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

Instance Method Details

#call(resource) ⇒ Object


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

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

#copy(model) ⇒ Object


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

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