simple_calendar 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_calendar/calendar.rb +7 -5
- data/lib/simple_calendar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6e45d3cc2325f4e4cc4471bb06bbcacf2405e5
|
4
|
+
data.tar.gz: 8807141d35ac07d3ff9c32a2c138f5d90e268609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a44808b94525df58df4921a95e37bc340316a84f92faab3042e258f8793f95a69d85c91156044b8811c89db048fddddd437b09970d3ed0694f08aaf14eecc16
|
7
|
+
data.tar.gz: 385b3148fa1987b941ad8a279e59a90bf7fed0076307e2d7838e8b609d0e8a290f31386a27af0ab4a5f0116cad83a9cc33cee4ac04b7fbe973e4cd79e04667af
|
@@ -68,9 +68,10 @@ module SimpleCalendar
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def sorted_events
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
@sorted_events ||= begin
|
72
|
+
events = options.fetch(:events, []).reject { |e| e.send(attribute).nil? }.sort_by(&attribute)
|
73
|
+
group_events_by_date(events)
|
74
|
+
end
|
74
75
|
end
|
75
76
|
|
76
77
|
def group_events_by_date(events)
|
@@ -78,11 +79,12 @@ module SimpleCalendar
|
|
78
79
|
|
79
80
|
events.each do |event|
|
80
81
|
event_start_date = event.send(attribute).to_date
|
81
|
-
event_end_date = (event.respond_to?(end_attribute) && !event.
|
82
|
-
(event_start_date..event_end_date).
|
82
|
+
event_end_date = (event.respond_to?(end_attribute) && !event.send(end_attribute).nil?) ? event.send(end_attribute).to_date : event_start_date
|
83
|
+
(event_start_date..event_end_date.to_date).each do |enumerated_date|
|
83
84
|
events_grouped_by_date[enumerated_date] << event
|
84
85
|
end
|
85
86
|
end
|
87
|
+
|
86
88
|
events_grouped_by_date
|
87
89
|
end
|
88
90
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|