Class: LevelTravel::HotTours::Params

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/level_travel/hot_tours/params.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/level_travel/hot_tours/params.rb', line 19

def to_h
  result = super.merge(
    start_date: start_date.strftime('%d.%m.%Y'),
    end_date: end_date.strftime('%d.%m.%Y')
  )

  %i[countries nights stars pansions].each do |attr|
    result = result.merge(attr => public_send(attr).join(',')) if result[attr]
  end

  result
end