Class: Eventable::OpeningTime

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/eventable/opening_time.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.day_selectorObject



10
11
12
# File 'app/models/eventable/opening_time.rb', line 10

def self.day_selector
  (0..6).to_a.map {|n| [I18n.translate(:'date.day_names')[n],n]}
end

.time_selectorObject



14
15
16
17
18
# File 'app/models/eventable/opening_time.rb', line 14

def self.time_selector
  (0..48).to_a.map do |n|
    [to_time_string(n*30), n*30]
  end
end

Instance Method Details

#after_initializeObject



20
21
22
23
# File 'app/models/eventable/opening_time.rb', line 20

def after_initialize
  self.minutes_start ||= 540
  self.minutes_end ||= 1080
end

#closed_atObject



29
30
31
# File 'app/models/eventable/opening_time.rb', line 29

def closed_at
  to_time_string(minutes_end)
end

#open_atObject



25
26
27
# File 'app/models/eventable/opening_time.rb', line 25

def open_at
  to_time_string(minutes_start)
end