timer_with_snooze 0.0.1 → 0.0.4

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: a93fe65589e5d0ca3a3c39cf28ab38202bd14c9baa3b972c46426af3f48976a2
4
- data.tar.gz: 01aad4e162f334aa61ce4189d368ec469bef6643bb7944afed5b1d1ff3ea562b
3
+ metadata.gz: fb7b447689ef9ef50c5b6dc579c16c4de2d8ca9a0097b66895b7dbcfa1037bca
4
+ data.tar.gz: a5b1c42563444f76834eab4bc3e024a0180a02b027f23b8912f2494490dc3e20
5
5
  SHA512:
6
- metadata.gz: 5b1888e40c2c04d237649b2f19ec2efe75d8496a6dc4cd79facbab212f6fbd821b026bddaa637e3875918ebb0579299821ac3d13dfcc4d250560655a802ab49c
7
- data.tar.gz: e5ddb93e4e9b44d452753c4f37999d6924de515605f11afb21fdf7e918e0241270dc71e0d4bc9a616a562ea2b45153cae3019f7f4cbdd9c79beef43f23d59d21
6
+ metadata.gz: e372234317d81a03d9e397e125454409ba168b5a32d565c96bfd8290fb84e31867075933adddbb43ec2721d75c6bad8819f00d27d2b12e92091ca0d6d1aab464
7
+ data.tar.gz: 69a6a30c974a087ac476037bc467fa120beba7b59e7f76b940906706f7f101db0242d371d0f1e42a79703115d4ad6e1cbe48979e7e5f3abcf11c6423351b92ad
data/config.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "i18n"
2
+
3
+ dir = File.expand_path('..', __FILE__)
4
+ local_files = Dir.glob(File.join(dir, 'locales/*.yml'))
5
+ I18n.load_path = local_files
6
+
7
+
8
+ #I18n.locale = :ja
9
+ I18n.locale = :en
data/lib/config.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "i18n"
2
+
3
+ dir = File.expand_path('..', __FILE__)
4
+ I18n.load_path = Dir.glob(File.join(dir, 'locales/*.yml'))
5
+
6
+ #I18n.locale = :ja
7
+ I18n.locale = :en
@@ -0,0 +1,9 @@
1
+ en:
2
+ input_hour: Please input hour of clock.
3
+ err_hour: The value of hour is not proper.
4
+ input_minute: Please input minute of clock.
5
+ err_minute: The value of minute is not proper.
6
+ add_this_time: Will you add this time to clock? (y/n)
7
+ add_more_time: You want add more times to clock? (y/n)
8
+ display_times: The setting times on clock is as follows.
9
+ start_clock: Do you want start the clock? (y/n)
@@ -0,0 +1,9 @@
1
+ ja:
2
+ input_hour: タイマーの時間を入力。
3
+ err_hour: 時間の値が不適です。
4
+ input_minute: タイマーの分を入力
5
+ err_minute: 分の値が不適です。
6
+ add_this_time: この時刻を追加しますか?(y/n)
7
+ add_more_time: さらに時刻を追加しますか?(y/n)
8
+ display_times: 設定時刻は以下の通りです。
9
+ start_clock: タイマーを起動しますか?(y/n)
data/lib/run_sample.rb CHANGED
@@ -5,7 +5,7 @@ include TimerWithSnooze
5
5
  alert = Alert.new
6
6
  alert.setting
7
7
 
8
- go = InputData.input_str_validation("タイマーを起動しますか?(y/n)", 'y')
8
+ go = InputData.input_str_validation(I18n.t("start_clock"), 'y')
9
9
  if go
10
10
  alert.ring
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module TimerWithSnooze
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,4 +1,17 @@
1
1
  require "timer_with_snooze/version"
2
+ require "i18n"
3
+ require_relative "config"
4
+
5
+ #require File.join(File.expand_path('..', __FILE__), 'config.rb')
6
+ #require_relative "config"
7
+
8
+ =begin
9
+ dir = File.expand_path('..', __FILE__)
10
+ local_files = Dir.glob(File.join(dir, 'locales/*.yml'))
11
+ I18n.load_path = local_files
12
+ #I18n.locale = :ja
13
+ I18n.locale = :en
14
+ =end
2
15
 
3
16
  module TimerWithSnooze
4
17
 
@@ -18,19 +31,19 @@ module TimerWithSnooze
18
31
  def _setting
19
32
  result = false
20
33
  until result
21
- hour = InputData.input_int_validation("タイマーの時間を入力")
34
+ hour = InputData.input_int_validation I18n.t("input_hour")
22
35
  result = hour.between?(0,23)
23
36
  if !result
24
- puts "時間の値が不適です。"
37
+ puts I18n.t("err_hour")
25
38
  end
26
39
  end
27
40
 
28
41
  result = false
29
42
  until result
30
- minute = InputData.input_int_validation("タイマーの分を入力")
43
+ minute = InputData.input_int_validation I18n.t("input_minute")
31
44
  result = minute.between?(0,59)
32
45
  if !result
33
- puts "分の値が不適です。"
46
+ puts I18n.t("err_minute")
34
47
  end
35
48
  end
36
49
 
@@ -41,7 +54,7 @@ module TimerWithSnooze
41
54
  time_arr = [yr,mn,dd,hour,minute,0]
42
55
 
43
56
  atime = Time.new(*time_arr)
44
- ans = InputData.input_str_validation("#{atime} この時刻を追加しますか?(y/n)", 'y')
57
+ ans = InputData.input_str_validation("#{atime}" + I18n.t("add_this_time"), 'y')
45
58
  if ans
46
59
  @stops << atime
47
60
  end
@@ -51,7 +64,7 @@ module TimerWithSnooze
51
64
  result = true
52
65
  while result
53
66
  _setting
54
- result = InputData.input_str_validation("さらに時刻を追加しますか?(y/n)", 'y')
67
+ result = InputData.input_str_validation(I18n.t("add_more_time"), 'y')
55
68
  end
56
69
 
57
70
  list_all_stops
@@ -80,7 +93,7 @@ module TimerWithSnooze
80
93
  end
81
94
 
82
95
  def list_all_stops
83
- puts '設定時刻は以下の通りです。'
96
+ puts I18n.t("display_times")
84
97
  @stops.each do |stop|
85
98
  puts "#{stop}"
86
99
  end
@@ -106,14 +119,14 @@ module TimerWithSnooze
106
119
  puts "SIGINT"
107
120
  exit(0)
108
121
  else
109
- puts "Snooze stoped\n"
110
- return true
122
+ puts "Snooze stopped\n"
123
+ return true
111
124
  end
112
125
  }
113
126
 
114
127
  print "."; #puts Alert.runtime_class.now
115
128
 
116
- if !snoozup and Alert.runtime_class.now >= stoptime
129
+ if !snoozup and Alert.runtime_class.now >= stoptime and Alert.runtime_class.now < stoptime + 60 * 15
117
130
  puts "snooze started at #{stoptime}"
118
131
  snoozup = snooze
119
132
  end
@@ -134,8 +147,8 @@ module TimerWithSnooze
134
147
  return true
135
148
  }
136
149
 
137
- 5.times do
138
- print "wake up! "
150
+ 15.times do
151
+ print "wake up! \a "
139
152
  sleep 2
140
153
  end
141
154
  print "\n"
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_development_dependency "bundler", "~> 1.16"
33
33
  spec.add_development_dependency "rake", "~> 12.3"
34
+ spec.add_development_dependency "i18n", "~> 1.0"
34
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timer_with_snooze
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - n.hodoshima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-11 00:00:00.000000000 Z
11
+ date: 2018-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '12.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: i18n
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
41
55
  description: timer under construction.
42
56
  email:
43
57
  - hodoshima@job4sp.com
@@ -55,7 +69,11 @@ files:
55
69
  - Rakefile
56
70
  - bin/console
57
71
  - bin/setup
72
+ - config.rb
58
73
  - exe/timer_with_snooze
74
+ - lib/config.rb
75
+ - lib/locales/en.yml
76
+ - lib/locales/ja.yml
59
77
  - lib/run_sample.rb
60
78
  - lib/timer_with_snooze.rb
61
79
  - lib/timer_with_snooze/version.rb