flippy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +3 -0
- data/lib/flippy/version.rb +1 -1
- data/lib/flippy/vertical.rb +8 -2
- data/spec/vertical_spec.rb +36 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6837facdd05e44c2beafb7d4ecbcb799a1e26a85
|
4
|
+
data.tar.gz: b9dc0c89e52e6764e88819140b53c85a061adb43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960bccc18997413b2c76968403b24a830ae66d7b9ce5e486a83e931c28cef848bc1f5fb03bcdde8dccefe61060ba5eed411459382a7c02130c5c321593256e03
|
7
|
+
data.tar.gz: d689d0b6be66fabf35c4e6801870d341ab525504a0f5df01ad3be328b5a99fde9d558ffbabb1d6fefbc22ab918b98eb3a920cbec478dd00646d85cd2417fd40b
|
data/History.txt
CHANGED
data/lib/flippy/version.rb
CHANGED
data/lib/flippy/vertical.rb
CHANGED
@@ -28,7 +28,12 @@ module Flippy::Vertical
|
|
28
28
|
main_line << chr
|
29
29
|
punc_line << ' '
|
30
30
|
else
|
31
|
-
punc_line
|
31
|
+
if PUNC.include?(punc_line.last)
|
32
|
+
main_line << ' '
|
33
|
+
punc_line << chr
|
34
|
+
else
|
35
|
+
punc_line[-1] = chr
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
34
39
|
lines << punc_line << main_line
|
@@ -37,6 +42,7 @@ module Flippy::Vertical
|
|
37
42
|
max = lines.map(&:size).max
|
38
43
|
lines.map { |line| line.fill(' ', line.size...max) }
|
39
44
|
.transpose
|
40
|
-
.map { |line| line.join.reverse }.join("\n")
|
45
|
+
.map { |line| line.join.reverse }.join("\n")
|
46
|
+
.gsub(/ +$/, '').concat("#{h_part}")
|
41
47
|
end
|
42
48
|
end
|
data/spec/vertical_spec.rb
CHANGED
@@ -6,11 +6,11 @@ describe Flippy do
|
|
6
6
|
context "with any strings" do
|
7
7
|
subject { "こんにちはー、\n日本。".vertical }
|
8
8
|
it { should eq <<-EOS.chomp }
|
9
|
-
日 こ
|
10
|
-
本。ん
|
11
|
-
に
|
12
|
-
ち
|
13
|
-
は
|
9
|
+
日 こ
|
10
|
+
本。ん
|
11
|
+
に
|
12
|
+
ち
|
13
|
+
は
|
14
14
|
|、
|
15
15
|
EOS
|
16
16
|
end
|
@@ -18,38 +18,50 @@ EOS
|
|
18
18
|
context "with any strings(multiple punctuations)" do
|
19
19
|
subject { "こんにちはー、\n日本。人。".vertical }
|
20
20
|
it { should eq <<-EOS.chomp }
|
21
|
-
日 こ
|
22
|
-
本。ん
|
23
|
-
人。に
|
24
|
-
ち
|
25
|
-
は
|
21
|
+
日 こ
|
22
|
+
本。ん
|
23
|
+
人。に
|
24
|
+
ち
|
25
|
+
は
|
26
26
|
|、
|
27
27
|
EOS
|
28
28
|
end
|
29
29
|
|
30
|
+
context "with any strings(sequential multiple punctuations)" do
|
31
|
+
subject { "今日は、、いい\n天気、です。。".vertical }
|
32
|
+
it { should eq <<-EOS.chomp }
|
33
|
+
天 今
|
34
|
+
気、日
|
35
|
+
で は、
|
36
|
+
す。 、
|
37
|
+
。い
|
38
|
+
い
|
39
|
+
EOS
|
40
|
+
end
|
41
|
+
|
30
42
|
context "vertical horizontal mix string" do
|
31
43
|
subject { "ニッポンの//自然".vertical }
|
32
44
|
it { should eq <<-EOS.chomp }
|
33
|
-
ニ
|
34
|
-
ッ
|
35
|
-
ポ
|
36
|
-
ン
|
37
|
-
|
45
|
+
ニ
|
46
|
+
ッ
|
47
|
+
ポ
|
48
|
+
ン
|
49
|
+
の自然
|
38
50
|
EOS
|
39
51
|
end
|
40
52
|
|
41
53
|
context "vertical horizontal mix string" do
|
42
54
|
subject { "ニッポンの//自然//大切に。".vertical }
|
43
55
|
it { should eq <<-EOS.chomp }
|
44
|
-
ニ
|
45
|
-
ッ
|
46
|
-
ポ
|
47
|
-
ン
|
48
|
-
の
|
49
|
-
/
|
50
|
-
/
|
51
|
-
自
|
52
|
-
|
56
|
+
ニ
|
57
|
+
ッ
|
58
|
+
ポ
|
59
|
+
ン
|
60
|
+
の
|
61
|
+
/
|
62
|
+
/
|
63
|
+
自
|
64
|
+
然大切に。
|
53
65
|
EOS
|
54
66
|
end
|
55
67
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flippy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyoendo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|