hometime 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hometime.rb +16 -14
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d979c13c4c4b2e786dcdb6a1b0c209c0c1999af32fc05fc166f9d1d6ba852bf
4
- data.tar.gz: 4e93c58ac67218055fbb274ee306fab00966a7e190303e9ca5596b0f132b7d56
3
+ metadata.gz: ae6b0265c1dc2c49ca4f02adf98b55967ca45cb0c8f8ede0030f7178ebb53c4b
4
+ data.tar.gz: d1b471286bdbeca9d25b6e8ab5309039552b77a7f39338abae87c510b51201f5
5
5
  SHA512:
6
- metadata.gz: 7450792ce32aa88f26d2c47202570fe23b50dbbc3194a046f791854da269b177be300e9ccbcfe378dba264dda238e4e245dc45f0e62ee1522ec4fc79277b9012
7
- data.tar.gz: 7259f28495e8128b45050c75e76b508cc315b42005b8924279a22d4a4ba58becf1f7f23f4c0264b370517dea9f3a0fb6f20d5dc56c144d48ba49bc6023df9040
6
+ metadata.gz: 40b028f3a0c83cd5afdb555460dbf5033c2f9913d9d4cbec6e089c4244cefb9348d1f68443b9806d2c23bec1def151ec3db7075c6d5cd850a7a359f884d535bd
7
+ data.tar.gz: 9eec38137e838f1df585bc950a31e223e4c6e06b967daa392ee4eeb2d4d71930ffc4e93902709d464bec59cf17c4d746e7773d9273d7c661b56ab6d33015d94d
data/lib/hometime.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  class Hometime
2
- def self.initialize(duration)
3
- puts 'What time did you start?'
4
-
5
- @time = gets.chomp
2
+ def self.initialize(duration, start_time)
3
+ @time = start_time
6
4
  @duration = duration
7
5
 
8
- puts "Home time is #{leave_time.strftime('%H:%M')}."
9
- puts "Only #{unit_formatted('hour', hours)}#{unit_formatted('minute', minutes)}" \
10
- "#{unit_formatted('second', seconds)}until home time!"
11
- christmas
6
+ {
7
+ 'leave_time': leave_time.strftime('%H:%M'),
8
+ 'hours_remaining': unit_formatted('hour', hours),
9
+ 'minutes_remaining': unit_formatted('minute', minutes),
10
+ 'seconds_remaining': unit_formatted('second', seconds)
11
+ }
12
12
  end
13
13
 
14
14
  private
@@ -61,17 +61,19 @@ class Hometime
61
61
  leave_time - current_time
62
62
  end
63
63
 
64
- # Days until Christmas
65
- def self.christmas
66
- puts "#{days_until_christmas_date} days until Christmas!" if days_until_christmas_date > 0
64
+ # TODO - Read important date from file
65
+ def self.important_dates
66
+ file = File.read('../data/dates.json')
67
+
68
+ puts "#{days_until_important_date_date} days until Christmas!" if days_until_important_date_date > 0
67
69
  end
68
70
 
69
- def self.christmas_date
71
+ def self.important_date_date
70
72
  this_year = Time.now.strftime('%Y').to_i
71
73
  Time.new(this_year, 12, 25)
72
74
  end
73
75
 
74
- def self.days_until_christmas_date
75
- ((((christmas_date - current_time) / 60) / 60) / 24).ceil
76
+ def self.days_until_important_date_date
77
+ ((((important_date_date - current_time) / 60) / 60) / 24).ceil
76
78
  end
77
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hometime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hodgson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to calculate when your shift ends
14
14
  email: james.hodgson@sage.com
@@ -21,7 +21,7 @@ homepage: https://rubygems.org/gems/hometime_jameshodgson
21
21
  licenses:
22
22
  - MIT
23
23
  metadata: {}
24
- post_install_message:
24
+ post_install_message:
25
25
  rdoc_options: []
26
26
  require_paths:
27
27
  - lib
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubygems_version: 3.0.3
40
- signing_key:
40
+ signing_key:
41
41
  specification_version: 4
42
42
  summary: Home Time
43
43
  test_files: []