creative_rails_utilities 0.4.7 → 0.4.8

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: a156e7e7a2f650eb2d1bca609e59b5001155804b
4
- data.tar.gz: 76fae005a8e49f46b77e37d154d35962753944ca
3
+ metadata.gz: ec216facf16d392f58bef85bc6d824045cc9f930
4
+ data.tar.gz: 49891ca9b12cba3bbbafb60d0040d2d55abe4664
5
5
  SHA512:
6
- metadata.gz: 5ec35aa7b310c410b5ca2985ec86c5a5745d26659e423cc8784c92a092ffbc0b83091702880dfb84f060ba12b9c0cd8f1f4166a540b6aa34d80fe1c557af87c2
7
- data.tar.gz: 3f8827f4bbc6fbeeadf7c2cc0a8e472692b005ff23d35e246e69cf0691894cbdebe4fe10d6da258e86f65809a4a8a583af4af0e2dcaca06a3449a95abe56869e
6
+ metadata.gz: a2ebe8ddec2051b689bb9ef4f577859b11e39e8068f2173e8d34ce4bd82560fe98a0ce6b0ae36e5802673392db004c12227ad004fafdc9d4a5f0740b0c0a7991
7
+ data.tar.gz: e13a7928c3fbb626ae4a83d589e32c61fddb724917afc3953d90dae45cec1fe1f055fdddb8dad07ef18ae0c6b2ea09b73353e078996800392a81d50a67525acd
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ cru
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.10
data/README.md CHANGED
@@ -26,18 +26,30 @@ Feel free to read the source under `/lib/creative_rails_utilities/` and peruse t
26
26
  # => [:a, :b, :c]}
27
27
  ```
28
28
 
29
- ##### Date
29
+ ### Date
30
+
31
+ __.build_date_array(start_date, end_date)__
32
+ Get an array of date objects
30
33
 
31
34
  ```ruby
32
- # get an array of date objects
33
35
  Date.build_date_array("2015-10-11", "2015-10-13") #=> ["2015-10-11".to_date, "2015-10-12".to_date "2015-10-13".to_date]
34
36
  ```
35
37
 
38
+ __.range(start_date, end_date)__
39
+ Get a Datetime range covering bot dates completely
40
+
41
+ ```rb
42
+ Date.range("2018-06-14", "2018-06-16")
43
+ #=> Thu, 14 Jun 2018 00:00:00 UTC +00:00..Sat, 16 Jun 2018 23:59:59 UTC +00:00
44
+ ```
45
+
46
+ __.build_date_array(end_date)__
36
47
  ```ruby
37
48
  # get an array of dates between one date object and another
38
49
  "2015-10-11".to_date.build_date_array("2015-10-09") #=> ["2015-10-09".to_date, "2015-10-10".to_date, "2015-10-11".to_date]
39
50
  ```
40
51
 
52
+ __.array_with_pre_churn_limit(day_limit)__
41
53
  ```ruby
42
54
  # build a range of dates that will never go beyond a limit and/or yesterday
43
55
  # used for accessing pre-churned data for strictly past days
@@ -49,7 +61,7 @@ Date.build_date_array("2015-10-11", "2015-10-13") #=> ["2015-10-11".to_date, "20
49
61
  "2015-10-11".to_date.array_with_pre_churn_limit(30) #=> ["2015-10-11".to_date, .. 28 .. , "2015-11-10".to_date ]
50
62
  ```
51
63
 
52
- ##### Hash
64
+ ### Hash
53
65
 
54
66
  ```ruby
55
67
  # dig for deep nested values in a hash safely
@@ -151,8 +163,9 @@ HostParser.new("deep.nested.subdomain.google.com").domain #=> "google.com"
151
163
 
152
164
  ##### Object
153
165
 
154
- __Object.chain_if(switch, operator, *args)__
155
- __Object#chain_if(switch, operator, *args)__
166
+ __Object.chain_if(switch, operator, *args)__
167
+ __Object#chain_if(switch, operator, *args)__
168
+
156
169
  ```rb
157
170
  # Allows smart conditional chaining of method calls or Procs
158
171
  # Works on Object and its descendants, class or instance
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = %q|Creative's assorted hacks, fixes and monkeypatches to Ruby and Rails base classes|
15
15
  spec.homepage = "https://github.com/CreativePublisher/creative_rails_utilities"
16
16
  spec.license = "MIT"
17
- spec.date = Date.today.to_s
17
+ spec.date = "2018-06-15"
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  spec.bindir = "exe"
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "activesupport", ">= 3"
25
25
  spec.add_dependency "ranger"
26
26
  spec.add_dependency "hashrush"#, "~> 2.0.0"
27
- spec.add_dependency "ruby_dig" # provides hash and array .dig
27
+ spec.add_dependency "ruby_dig" # provides hash and array .dig before 2.3
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.10"
30
30
  spec.add_development_dependency 'simplecov'
@@ -14,7 +14,11 @@ class Date
14
14
  processable_date = processable_date.tomorrow
15
15
  end
16
16
 
17
- return date_array
17
+ date_array
18
+ end
19
+
20
+ def self.range(start, _end)
21
+ start.to_date.beginning_of_day.._end.to_date.end_of_day
18
22
  end
19
23
 
20
24
  def build_date_array(date)
@@ -1,3 +1,3 @@
1
1
  module CreativeRailsUtilities
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creative_rails_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Creative
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -160,6 +160,8 @@ extra_rdoc_files: []
160
160
  files:
161
161
  - ".gitignore"
162
162
  - ".rspec"
163
+ - ".ruby-gemset"
164
+ - ".ruby-version"
163
165
  - ".travis.yml"
164
166
  - CHANGELOG.md
165
167
  - Gemfile
@@ -203,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
205
  version: '0'
204
206
  requirements: []
205
207
  rubyforge_project:
206
- rubygems_version: 2.4.6
208
+ rubygems_version: 2.6.14
207
209
  signing_key:
208
210
  specification_version: 4
209
211
  summary: Creative's assorted hacks, fixes and monkeypatches to Ruby and Rails base