jekyll_time_since 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: '0668a30bfe9ba5327d29451e667484bff0a74e5159c3a1be8a94f8b250d813cd'
4
- data.tar.gz: 594a56810f767dfa4eb4e77a0c32d8394465792b03f1aa80f988bee2c1e27b90
3
+ metadata.gz: e920db50f451b9b1633ec109d830d658463a77c205e5de7e5c79f46285b8cfe0
4
+ data.tar.gz: 4fa4443f9d98082b57dd37156d1239885faac75984fc16135c5c2a3d3939a6b7
5
5
  SHA512:
6
- metadata.gz: 887f887e114a7256676190995521d2468c3616d86fc82a3e8fd37ac05151dedf65e80ed4f5d7f145f3beff6ae3e7108c07e426fa860352275afc91813f550610
7
- data.tar.gz: 6553172ec5f0f2c8043bfee170fec0b0878e969684b89ec65f9d9bc8020c5e9cf73065705264058312f0e3a45a581e8fd5b4d58cd3b4469554f7ec92d380b5b8
6
+ metadata.gz: 1db563761c609395688ffda42c028495e48f93008d405929183715065938008f5d592ece80140431602650630b139efa15066f72b7c93cb81832b19d6d9c72ed
7
+ data.tar.gz: e02291e860e2464dd135225a08de0747265cdd5db1a17ee2ce0f033ce43c76d70933d587757475e38049ca5df0f6a0ba8df16a5fc84a5114e5622e9976b5e709
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.3 / 2023-01-26
2
+ * Fixed registration
3
+ * Improved testing
4
+
1
5
  ## 0.1.2 / 2023-01-25
2
6
  * Fixed return value
3
7
 
@@ -1,3 +1,3 @@
1
1
  module JekyllTimeSinceVersion
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -12,57 +12,59 @@ end
12
12
  #
13
13
  # Just a year can be specified, which implies Jan 1 at midnight.
14
14
  # You can specify a time zone
15
- # For more information, see https://ruby-doc.org/stdlib-2.7.2/libdoc/time/rdoc/Time.html
16
- module TimeSince
17
- @logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
15
+ module Jekyll
16
+ # For more information, see https://ruby-doc.org/stdlib-2.7.2/libdoc/time/rdoc/Time.html
17
+ module TimeSince
18
+ @logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
18
19
 
19
- # Filters a string containing a year, date or ISO_8601 datetime.
20
- # @return [integer] the number of years since the input.
21
- def years_since(string)
22
- now = DateTime.now
23
- string += '-01-01' unless string.include?('-')
24
- date = Time.parse(string)
25
- years = now.year - date.year
26
- years -= 1 if date.month > now.month || (date.month >= now.month && date.day > now.day)
27
- years
28
- end
20
+ # Filters a string containing a year, date or ISO_8601 datetime.
21
+ # @return [integer] the number of years since the input.
22
+ def years_since(string)
23
+ now = DateTime.now
24
+ string += '-01-01' unless string.include?('-')
25
+ date = Time.parse(string)
26
+ years = now.year - date.year
27
+ years -= 1 if date.month > now.month || (date.month >= now.month && date.day > now.day)
28
+ years
29
+ end
29
30
 
30
- def months_since(string)
31
- string += '-01-01' unless string.include?('-')
32
- date1 = Date.parse(string)
31
+ def months_since(string)
32
+ string += '-01-01' unless string.include?('-')
33
+ date1 = Date.parse(string)
33
34
 
34
- date2 = Time.new.to_date
35
- months = ((date2 - date1).to_f / 365 * 12).round
36
- months -= 1 if date2.day > date1.day
37
- months
38
- end
35
+ date2 = Time.new.to_date
36
+ months = ((date2 - date1).to_f / 365 * 12).round
37
+ months -= 1 if date2.day > date1.day
38
+ months
39
+ end
39
40
 
40
- def weeks_since(string)
41
- result = days_since(string)
42
- result.to_i / 7
43
- end
41
+ def weeks_since(string)
42
+ result = days_since(string)
43
+ result.to_i / 7
44
+ end
44
45
 
45
- def days_since(string)
46
- string += '-01-01' unless string.include?('-')
47
- date1 = Date.parse(string)
46
+ def days_since(string)
47
+ string += '-01-01' unless string.include?('-')
48
+ date1 = Date.parse(string)
48
49
 
49
- date2 = Time.new.to_date
50
- (date2 - date1).to_i
51
- end
50
+ date2 = Time.new.to_date
51
+ (date2 - date1).to_i
52
+ end
52
53
 
53
- def hours_since(string)
54
- minutes_since(string) / 60
55
- end
54
+ def hours_since(string)
55
+ minutes_since(string) / 60
56
+ end
56
57
 
57
- def minutes_since(string)
58
- seconds_since(string) / 60
59
- end
58
+ def minutes_since(string)
59
+ seconds_since(string) / 60
60
+ end
60
61
 
61
- def seconds_since(string)
62
- string += '-01-01' unless string.include?('-')
63
- (Time.new - Time.parse(string)).to_i
62
+ def seconds_since(string)
63
+ string += '-01-01' unless string.include?('-')
64
+ (Time.new - Time.parse(string)).to_i
65
+ end
64
66
  end
65
67
  end
66
68
 
67
69
  PluginMetaLogger.instance.info { "Loaded #{JekyllTimeSinceName::PLUGIN_NAME} v#{JekyllTimeSinceVersion::VERSION} plugin." }
68
- Liquid::Template.register_tag(JekyllTimeSinceName::PLUGIN_NAME, TimeSince)
70
+ Liquid::Template.register_filter(Jekyll::TimeSince)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_time_since
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-25 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -58,7 +58,6 @@ files:
58
58
  - lib/jekyll_time_since/version.rb
59
59
  - spec/jekyll_time_since_spec.rb
60
60
  - spec/spec_helper.rb
61
- - spec/status_persistence.txt
62
61
  homepage: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
63
62
  licenses:
64
63
  - MIT
@@ -1,3 +0,0 @@
1
- example_id | status | run_time |
2
- ------------------------------------- | ------ | ------------ |
3
- ./spec/jekyll_time_since_spec.rb[1:1] | passed | 7.91 seconds |