Module: Card::Model::SaveHelper::SaveHelperHelper

Included in:
Card::Model::SaveHelper
Defined in:
card/lib/card/model/save_helper/save_helper_helper.rb

Overview

private helper methods for public SaveHelper api

Constant Summary collapse

CARDTYPE_METHOD_REGEXP =
/^(?<method_name>create|ensure)_(?<type>.+?)(?:_card)?$/

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



28
29
30
31
32
33
34
# File 'card/lib/card/model/save_helper/save_helper_helper.rb', line 28

def method_missing method, *args
  method_name, cardtype_card = extract_cardtype_from_method_name method
  return super unless method_name

  sargs = standardize_args(*args)
  send "#{method_name}_card", sargs.merge(type_id: cardtype_card.id)
end