flippy 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 680e17639137bdc5372e7ed9698f7b4617ed0aa1
4
+ data.tar.gz: 16304d3aadf71da75b8bcf492db607918dabd37c
5
+ SHA512:
6
+ metadata.gz: a710e48dd9248ab3b75e04fcde9ace756f40629dfa0f318558d60c363297f07b5d6c347b155e1fe3cf70f2f64c425d02ea3e41e4e2242e85471271a89e0bf746
7
+ data.tar.gz: 52a3d6cac40465ba36ecceb7599aea18b8fd817d9124a1d349dba4497e503dfef2d3702985f824228ac29c9666021f008c66e56fab5dcb8b9be4d96ee621dbdf
@@ -1,9 +1,13 @@
1
+ == 0.0.6 / 2013-03-17
2
+ * Add Flippy#vertical for conversion of left-right vertical writing style
3
+ * Add `vertical` option to flippy command
4
+
1
5
  == 0.0.5 / 2013-02-19
2
6
  * Add ctrl+F to flush screen for flippy console
3
7
 
4
8
  == 0.0.4 / 2013-02-19
5
9
  * Add Flippy::Console module
6
- * Add `console` option to flippy command
10
+ * Add `console` option to flippy command
7
11
  * Bug Fixes
8
12
 
9
13
  == 0.0.3 / 2013-02-04
data/README.md CHANGED
@@ -93,7 +93,8 @@ where [options] are:
93
93
  --unflip, -u: Unflip given text
94
94
  --table, -t: Output flippy mapping table
95
95
  --console, -c: Start flippy console
96
- --version, -v: Print version and exit
96
+ --vertical -v: Verticalize given text
97
+ --version, -e: Print version and exit
97
98
  --help, -h: Show this message
98
99
 
99
100
  In a flippy console, following keys works for control;
@@ -110,7 +111,9 @@ Thank you to Fumiaki Nishihara for disclosing a ASCII mapping table for text ups
110
111
  > twitter→ɹəʇʇɪʍʇのように英数字を180度回転して表示する方法|Colorless Green Ideas
111
112
  > http://id.fnshr.info/2013/01/25/upsidedowntext/
112
113
 
114
+ Thank you to @yubais for the idea of Flippy#vertical;
113
115
 
116
+ > 縦つい。 〜縦書きツイート作成ツール〜 http://yubais.net/tatetwi/
114
117
 
115
118
  ## Contributing
116
119
 
data/bin/flippy CHANGED
@@ -30,18 +30,20 @@ class OptionParser
30
30
  opt :unflip, "Unflip given text"
31
31
  opt :table, "Output flippy mapping table"
32
32
  opt :console, "Start flippy console"
33
+ opt :vertical, "Verticalize given text"
33
34
  end
34
35
  end
35
36
  end
36
37
 
37
38
  opts = OptionParser.parse!
38
- text = ARGV.join(' ')
39
+ text = ARGV.join("\n")
39
40
 
40
41
  puts begin
41
42
  case
42
43
  when opts[:table]; Flippy.table
43
44
  when opts[:unflip]; text.unflip
45
+ when opts[:vertical]; text.gsub(" ", "\n").vertical
44
46
  when opts[:console]; Flippy::Console.run
45
47
  when opts[:flip]; text.flip
46
48
  end
47
- end
49
+ end
@@ -9,8 +9,10 @@
9
9
 
10
10
  require_relative "flippy/version"
11
11
  require_relative "flippy/console"
12
+ require_relative "flippy/vertical"
12
13
 
13
14
  module Flippy
15
+ include Vertical
14
16
  T = [[65, 5572], [66, 5626], [67, 390], [68, 5601], [69, 398], [70, 8498], [71, 8513], [72, 72], [73, 73], [74, 5259], [75, 20012], [76, 8514], [77, 87], [78, 78], [79, 79], [80, 1280], [81, 908], [82, 7450], [83, 83], [84, 8869], [85, 1352], [86, 923], [87, 77], [88, 88], [89, 8516], [90, 90], [97, 592], [98, 113], [99, 596], [100, 112], [101, 601], [102, 607], [103, 595], [104, 613], [105, 7433], [106, 638], [107, 670], [108, 108], [109, 623], [110, 117], [111, 111], [112, 100], [113, 98], [114, 633], [115, 115], [116, 647], [117, 110], [118, 652], [119, 653], [120, 120], [121, 654], [122, 122], [48, 48], [49, 8642], [50, 423], [51, 949], [52, 5421], [53, 53], [54, 57], [55, 76], [56, 56], [57, 54], [46, 729], [44, 8216], [45, 45], [58, 58], [59, 1563], [33, 161], [63, 191], [38, 8523], [40, 41], [41, 40], [60, 62], [62, 60], [91, 93], [93, 91], [95, 8254], [8254, 95], [123, 125], [125, 123], [8756, 8757], [8757, 8756]]
15
17
 
16
18
  def self.table
@@ -1,3 +1,3 @@
1
1
  module Flippy
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,34 @@
1
+ module Flippy::Vertical
2
+ PUNC = ["、","。",",","."]
3
+
4
+ SYM = {
5
+ "ー" => "|",
6
+ "「" => "¬",
7
+ "」" => "∟",
8
+ "→" => "↓",
9
+ "↑" => "→",
10
+ "←" => "↑",
11
+ "↓" => "←",
12
+ "=" => "॥",
13
+ "…" => ":"
14
+ }
15
+
16
+ SYM1 = (SYM.keys + SYM.values).join
17
+ SYM2 = (SYM.values + SYM.keys).join
18
+
19
+ def vertical
20
+ lines = []
21
+ self.tr(SYM1, SYM2)
22
+ .each_line { |line|
23
+ line.chomp!
24
+ lines << line[1..-1].gsub(/[^#{PUNC.join}]/, ' ')
25
+ lines << line[0] + line[1..-1].gsub(/#{PUNC.join("|")}/, '')
26
+ }
27
+
28
+ max = lines.map(&:size).max
29
+ lines.map { |line|
30
+ Array.new(max, ' ').tap { |arr| arr[0, line.size] = line.split(//) }
31
+ }.transpose
32
+ .map { |line| line.join.reverse }.join("\n")
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ require_relative 'spec_helper'
3
+
4
+ describe Flippy do
5
+ describe "#vertical" do
6
+ subject { "こんにちはー、\n日本。".vertical }
7
+ it { should eq <<-EOS.chomp }
8
+ 日 こ 
9
+ 本。ん 
10
+   に 
11
+   ち 
12
+   は 
13
+   |、
14
+ EOS
15
+ end
16
+ end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - kyoendo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
11
+ date: 2013-03-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: trollop
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: ruby-termios
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Fippy makes a text upside down, like "twitter" to "ɹəʇʇᴉʍʇ".
@@ -78,32 +71,34 @@ files:
78
71
  - lib/flippy.rb
79
72
  - lib/flippy/console.rb
80
73
  - lib/flippy/version.rb
74
+ - lib/flippy/vertical.rb
81
75
  - spec/flippy_spec.rb
82
76
  - spec/spec_helper.rb
77
+ - spec/vertical_spec.rb
83
78
  homepage: https://github.com/melborne/flippy
84
79
  licenses: []
80
+ metadata: {}
85
81
  post_install_message:
86
82
  rdoc_options: []
87
83
  require_paths:
88
84
  - lib
89
85
  required_ruby_version: !ruby/object:Gem::Requirement
90
- none: false
91
86
  requirements:
92
- - - ! '>='
87
+ - - '>='
93
88
  - !ruby/object:Gem::Version
94
89
  version: 1.9.3
95
90
  required_rubygems_version: !ruby/object:Gem::Requirement
96
- none: false
97
91
  requirements:
98
- - - ! '>='
92
+ - - '>='
99
93
  - !ruby/object:Gem::Version
100
94
  version: '0'
101
95
  requirements: []
102
96
  rubyforge_project:
103
- rubygems_version: 1.8.25
97
+ rubygems_version: 2.0.0
104
98
  signing_key:
105
- specification_version: 3
99
+ specification_version: 4
106
100
  summary: Fippy makes a text upside down, like "twitter" to "ɹəʇʇᴉʍʇ".
107
101
  test_files:
108
102
  - spec/flippy_spec.rb
109
103
  - spec/spec_helper.rb
104
+ - spec/vertical_spec.rb