Class: AzaharaSchemaCurrency::CurrencyAttribute

Inherits:
AzaharaSchema::Attribute
  • Object
show all
Defined in:
lib/azahara_schema_currency/currency_attribute.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, name, type = 'currency', **options) ⇒ CurrencyAttribute

Returns a new instance of CurrencyAttribute.



8
9
10
11
# File 'lib/azahara_schema_currency/currency_attribute.rb', line 8

def initialize(model, name, type='currency', **options)
  super(model, name, type)
  @options = options
end

Instance Method Details

#currency_code(entity) ⇒ Object



17
18
19
# File 'lib/azahara_schema_currency/currency_attribute.rb', line 17

def currency_code(entity)
  entity.try(currency_code_col)
end

#currency_code_colObject



13
14
15
# File 'lib/azahara_schema_currency/currency_attribute.rb', line 13

def currency_code_col
  @options[:currency_code_method] || 'currency_code'
end