flippy 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/flippy/version.rb +1 -1
- data/lib/flippy/vertical.rb +20 -27
- data/spec/vertical_spec.rb +2 -4
- 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: 61114c78f3468c896b137d2da053589b0f399804
|
4
|
+
data.tar.gz: 483592a6c5effd53a93e8002270770bc982e18f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8729bb19965288a716b21faa9cc6ab878cc18732549a98f9e44f579c22a745a55c37b0de46ec78cdfc70ca5d74210676886e5e85f633a8945104459089bf9fc1
|
7
|
+
data.tar.gz: 1e655215b52b3e3bb1cd3ff2dfb746bb2d09109789920ac0799b44a9ae72e263027e23a5e65d1141dfdfe05f56f6311f6c5c1e29026a87afc5f5af73b701ada1
|
data/History.txt
CHANGED
data/lib/flippy/version.rb
CHANGED
data/lib/flippy/vertical.rb
CHANGED
@@ -1,37 +1,30 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
module Flippy::Vertical
|
3
|
-
PUNC =
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"」" => "∟",
|
9
|
-
"→" => "↓",
|
10
|
-
"↑" => "→",
|
11
|
-
"←" => "↑",
|
12
|
-
"↓" => "←",
|
13
|
-
"=" => "॥",
|
14
|
-
"…" => ":"
|
15
|
-
}
|
16
|
-
|
17
|
-
SYM1 = (SYM.keys + SYM.values).join
|
18
|
-
SYM2 = (SYM.values + SYM.keys).join
|
3
|
+
PUNC = %w(、 。 , .)
|
4
|
+
h = "ー「」→↑←↓=…"
|
5
|
+
v = "|¬∟↓→↑←॥:"
|
6
|
+
HV = (h + v)
|
7
|
+
VH = (v + h)
|
19
8
|
|
20
9
|
def vertical
|
21
10
|
lines = []
|
22
|
-
self.tr(
|
23
|
-
.each_line
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
11
|
+
self.tr(HV, VH)
|
12
|
+
.each_line do |line|
|
13
|
+
main_line, punc_line = [], []
|
14
|
+
line.chomp.each_char.with_index do |chr, i|
|
15
|
+
if i.zero? || !PUNC.include?(chr)
|
16
|
+
main_line << chr
|
17
|
+
punc_line << ' '
|
18
|
+
else
|
19
|
+
punc_line[-1] = chr
|
20
|
+
end
|
21
|
+
end
|
22
|
+
lines << punc_line << main_line
|
23
|
+
end
|
30
24
|
|
31
25
|
max = lines.map(&:size).max
|
32
|
-
lines.map { |line|
|
33
|
-
|
34
|
-
}.transpose
|
26
|
+
lines.map { |line| line.fill(' ', line.size...max) }
|
27
|
+
.transpose
|
35
28
|
.map { |line| line.join.reverse }.join("\n")
|
36
29
|
end
|
37
30
|
end
|
data/spec/vertical_spec.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.9
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|