Class: Calagator::Event::Browse

Inherits:
Struct
  • Object
show all
Defined in:
app/models/calagator/event/browse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Browse

Returns a new instance of Browse.



4
5
6
7
8
# File 'app/models/calagator/event/browse.rb', line 4

def initialize(attributes={})
  members.each do |key|
    send "#{key}=", attributes[key]
  end
end

Instance Attribute Details

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



3
4
5
# File 'app/models/calagator/event/browse.rb', line 3

def date
  @date
end

#orderObject

Returns the value of attribute order

Returns:

  • (Object)

    the current value of order



3
4
5
# File 'app/models/calagator/event/browse.rb', line 3

def order
  @order
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



3
4
5
# File 'app/models/calagator/event/browse.rb', line 3

def time
  @time
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/calagator/event/browse.rb', line 34

def default?
  values.all?(&:blank?)
end

#end_dateObject



18
19
20
# File 'app/models/calagator/event/browse.rb', line 18

def end_date
  date_for(:end).strftime('%Y-%m-%d')
end

#end_timeObject



26
27
28
# File 'app/models/calagator/event/browse.rb', line 26

def end_time
  time_for(:end).strftime('%I:%M %p') if time_for(:end)
end

#errorsObject



30
31
32
# File 'app/models/calagator/event/browse.rb', line 30

def errors
  @errors ||= []
end

#eventsObject



10
11
12
# File 'app/models/calagator/event/browse.rb', line 10

def events
  @events ||= sort.filter_by_date.filter_by_time.scope
end

#start_dateObject



14
15
16
# File 'app/models/calagator/event/browse.rb', line 14

def start_date
  date_for(:start).strftime('%Y-%m-%d')
end

#start_timeObject



22
23
24
# File 'app/models/calagator/event/browse.rb', line 22

def start_time
  time_for(:start).strftime('%I:%M %p') if time_for(:start)
end