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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba1a15f828524d2360d840b81cf5d33026f5119f
4
- data.tar.gz: 54d047f4bc6e09add1e78dbf441c825281391a87
3
+ metadata.gz: 9c6e45d3cc2325f4e4cc4471bb06bbcacf2405e5
4
+ data.tar.gz: 8807141d35ac07d3ff9c32a2c138f5d90e268609
5
5
  SHA512:
6
- metadata.gz: 8c5a5c027e124ab619e887eab798b09c01ef011ea6b14bdae6ac81f9adfeb5eaf7b3aa8bc2256151b927de6b05b27dd28c8425857d21e43b35acd4d421fe1679
7
- data.tar.gz: 8b9626f1f46a5353d5d99131fb4c9cc00e84f32dda7422f520e7d28270fc6e4952d922f382be564599f40391bbe6a95e10a20d79d03e7a530c5f655ff955959a
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
- events = options.fetch(:events, []).sort_by(&attribute)
72
- scheduled = events.reject { |e| e.send(attribute).nil? }
73
- group_events_by_date(scheduled)
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.respond_to?(end_attribute).nil?) ? event.send(end_attribute).to_date : event_start_date
82
- (event_start_date..event_end_date).to_a.each do |enumerated_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
 
@@ -1,3 +1,3 @@
1
1
  module SimpleCalendar
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.3"
3
3
  end
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.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: 2016-11-30 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails