azuma 0.0.0 → 0.0.1

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: fc6dffe3b29a775863de4b40c634206fa9fb8ad8
4
- data.tar.gz: 0181e57e71ad4b19ed71517e475822d048827edc
3
+ metadata.gz: 1d57bb230b01d3dc761f648e44ddd9444c6c5d1f
4
+ data.tar.gz: 928d6834211115541830ff9b4498d941283daee4
5
5
  SHA512:
6
- metadata.gz: 4a0db83120068a3726907282829b83d60fc0135a5f5b9e1135dd312cd082092edf9a77698d5247c55dae0f257f9d412d7c38aabce3d3fe8a928bb4306e26687b
7
- data.tar.gz: a7c0e0f10bba63f28d77ebf1c5b5f5d703a5558e2afc3586596e3ab6f3ce2162ba6ce15faa9f23fd2e498735ccf5065bf788f717b83ef9a963da33fa5b8ee7eb
6
+ metadata.gz: 85014e3f81b07a8bbd1fc2a6a8e505b2ca568c61fbac325dd0819b0ac6c9da67cdb8193b5d4c0c6167931204987323ee6666a79cb20f6037c3b856d7449ff70a
7
+ data.tar.gz: 7814648dee684dd8030a5a5b546de7e7917ead14ee68a2c23d553d0e90f88a3f87b1d2a32197f34f3fba3610d473b1bb00a477dbfc27c29ce3c604cea2675bcc
data/README.md CHANGED
@@ -11,7 +11,7 @@ $ gem install azuma
11
11
  ## USAGE
12
12
 
13
13
  ```
14
- azuma --talkers="小栗虫太郎,夢野久作,塔晶夫"
14
+ azuma --talkers="小栗虫太郎,夢野久作,塔晶夫" --lang=ja
15
15
  Ctrl-D to exit
16
16
  > press enter to show next talker
17
17
  次は塔晶夫さんの番です。
data/bin/azuma CHANGED
@@ -15,6 +15,7 @@ options = {}
15
15
 
16
16
  opt = OptionParser.new
17
17
  opt.on('-t', '--talkers="NAME1,NAME2..."') {|v| options[:talkers] = v }
18
+ opt.on('-l', '--lang=ja (DEFAULT en)') {|v| options[:lang] = v }
18
19
 
19
20
  begin
20
21
  opt.parse!(ARGV)
@@ -31,5 +32,6 @@ unless (talkers = options[:talkers])
31
32
  end
32
33
 
33
34
  talkers = talkers.split(',').map(&:strip)
35
+ language = options[:lang] || 'en'
34
36
 
35
- Azuma::CLI.start(talkers)
37
+ Azuma::CLI.start(talkers, language)
data/lib/azuma.rb CHANGED
@@ -4,8 +4,10 @@ require 'azuma/core'
4
4
  Azuma::Core.prepend Azuma::Announcement
5
5
 
6
6
  module Azuma
7
- def entry(talkers)
8
- Azuma::Core.new(talkers)
7
+ def entry(talkers, language)
8
+ core = Azuma::Core.new(talkers)
9
+ core.language = language
10
+ core
9
11
  end
10
12
 
11
13
  module_function :entry
@@ -2,20 +2,40 @@ require 'shellwords'
2
2
 
3
3
  module Azuma
4
4
  module Announcement
5
+ attr_accessor :language
6
+
5
7
  def next_talker
6
8
  super.tap do |talker|
7
9
  message = if talker
8
- "次は#{talker}さんの番です。"
10
+ designate_talker_message(talker)
9
11
  else
10
- "もう発表者はいません。お疲れ様でした。"
12
+ curtain_talk
11
13
  end
12
14
 
13
15
  puts message
14
16
 
15
17
  if /darwin/ === RUBY_PLATFORM
16
- spawn("say #{Shellwords.shellescape(message)}")
18
+ system("say #{Shellwords.shellescape(message)}")
17
19
  end
18
20
  end
19
21
  end
22
+
23
+ private
24
+
25
+ def designate_talker_message(talker)
26
+ if language == 'ja'
27
+ "次は#{talker}さんの番です。"
28
+ else
29
+ "Next is the turn of #{talker}."
30
+ end
31
+ end
32
+
33
+ def curtain_talk
34
+ if language == 'ja'
35
+ 'もう発表者はいません。お疲れ様でした。'
36
+ else
37
+ 'All of the presentation was the end. Thank you for your kind attention.'
38
+ end
39
+ end
20
40
  end
21
41
  end
data/lib/azuma/cli.rb CHANGED
@@ -2,15 +2,17 @@ require 'readline'
2
2
 
3
3
  module Azuma
4
4
  class CLI
5
- def self.start(talkers)
6
- roulette = Azuma.entry(talkers)
5
+ def self.start(talkers, language)
6
+ language ||= 'en'
7
+
8
+ azuma = Azuma.entry(talkers, language)
7
9
 
8
10
  Signal.trap(:EXIT) { puts; exit! }
9
11
 
10
12
  puts 'Ctrl-D to exit'
11
13
 
12
14
  while Readline.readline('> press enter to show next talker', true)
13
- break unless roulette.next_talker
15
+ break unless azuma.next_talker
14
16
  end
15
17
  end
16
18
  end
data/lib/azuma/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Azuma
2
- VERSION = '0.0.0'
2
+ VERSION = '0.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi ITO