Module: JpBank::ClassMethods

Defined in:
lib/jp_bank.rb

Instance Method Summary collapse

Instance Method Details

#jp_bank(attr_name, options = {}) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'lib/jp_bank.rb', line 11

def jp_bank(attr_name, options={})
  bank_code_method = options[:bank_code] || :bank_code

  self.class_eval do
    define_method attr_name do
      JpBank::Bank.fetch_bank_from_code(self.send(bank_code_method))
    end
  end
end