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

Included in:
Card::Model::SaveHelper
Defined in:
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)



20
21
22
23
24
25
26
# File 'lib/card/model/save_helper/save_helper_helper.rb', line 20

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