Class: Configs::Boats::BoatPrices

Inherits:
Object
  • Object
show all
Defined in:
app/serializers/configs/boats/boat_prices.rb

Class Method Summary collapse

Class Method Details

.attributes(price_attributes = ::Dictionaries::BoatCharterAttribute::ALL) ⇒ Object

список ценовых (продажа/аренда) атрибутов Лодки



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/serializers/configs/boats/boat_prices.rb', line 5

def self.attributes(price_attributes = ::Dictionaries::BoatCharterAttribute::ALL)
  attributes = []
  ::Dicts::Currency::ALL.each do |currency|
    price_attributes.map do |attr|
      field = Currency.attribute_name currency.index, attr
      next unless field

      attributes << field.to_sym
    end
    field = Currency.attribute_name currency.index, :sale_price
    attributes << field.to_sym
  end
  if block_given?
    attributes.each do |attribute|
      yield attribute
    end
  else
    attributes
  end
end