Class: Carendar::CalendarItem

Inherits:
Struct
  • Object
show all
Defined in:
lib/carendar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ends_atObject

Returns the value of attribute ends_at

Returns:

  • (Object)

    the current value of ends_at



9
10
11
# File 'lib/carendar.rb', line 9

def ends_at
  @ends_at
end

#offset_leftObject

Returns the value of attribute offset_left.



10
11
12
# File 'lib/carendar.rb', line 10

def offset_left
  @offset_left
end

#offset_rightObject

Returns the value of attribute offset_right.



10
11
12
# File 'lib/carendar.rb', line 10

def offset_right
  @offset_right
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



9
10
11
# File 'lib/carendar.rb', line 9

def options
  @options
end

#overlapping_with_earlierObject

Returns the value of attribute overlapping_with_earlier.



10
11
12
# File 'lib/carendar.rb', line 10

def overlapping_with_earlier
  @overlapping_with_earlier
end

#overlapping_with_laterObject

Returns the value of attribute overlapping_with_later.



10
11
12
# File 'lib/carendar.rb', line 10

def overlapping_with_later
  @overlapping_with_later
end

#starts_atObject

Returns the value of attribute starts_at

Returns:

  • (Object)

    the current value of starts_at



9
10
11
# File 'lib/carendar.rb', line 9

def starts_at
  @starts_at
end

Instance Method Details

#colorObject



27
28
29
30
31
# File 'lib/carendar.rb', line 27

def color
  '#' + (0..2).map do
    VisitorsController.r.rand(255).to_i.to_s(16)
  end.join('')
end

#dayObject



11
12
13
# File 'lib/carendar.rb', line 11

def day
  starts_at.beginning_of_day
end

#durationObject



15
16
17
# File 'lib/carendar.rb', line 15

def duration
  end_min - start_min
end

#end_minObject



23
24
25
# File 'lib/carendar.rb', line 23

def end_min
  ends_at.hour * 60 + ends_at.minute
end

#start_minObject



19
20
21
# File 'lib/carendar.rb', line 19

def start_min
  starts_at.hour * 60 + starts_at.minute
end