flippy 0.0.6 → 0.0.7

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: 680e17639137bdc5372e7ed9698f7b4617ed0aa1
4
- data.tar.gz: 16304d3aadf71da75b8bcf492db607918dabd37c
3
+ metadata.gz: 7953fdf72ddb0ae18ecd68c3025a97869672eca7
4
+ data.tar.gz: 608eb487cd019392e6eb0df87daf6a7bfaaaf625
5
5
  SHA512:
6
- metadata.gz: a710e48dd9248ab3b75e04fcde9ace756f40629dfa0f318558d60c363297f07b5d6c347b155e1fe3cf70f2f64c425d02ea3e41e4e2242e85471271a89e0bf746
7
- data.tar.gz: 52a3d6cac40465ba36ecceb7599aea18b8fd817d9124a1d349dba4497e503dfef2d3702985f824228ac29c9666021f008c66e56fab5dcb8b9be4d96ee621dbdf
6
+ metadata.gz: 6bedc81d02fce143787c053c2b96439af32f2ddbc126a98fc30a52d714d076e31ff732242998fd93cd53f879c42b4571f70a9ad60688db89579ea7f58000a6be
7
+ data.tar.gz: ae1f6f493cd013be7313352df1a4b00bbcd987350384bc21916978b33dfedba72f412c3e423c7f9082eb5a5da2039ec2e51b3dfe5868b10377639f2d3b3400b2
@@ -1,3 +1,3 @@
1
1
  module Flippy
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -21,8 +21,10 @@ module Flippy::Vertical
21
21
  self.tr(SYM1, SYM2)
22
22
  .each_line { |line|
23
23
  line.chomp!
24
- lines << line[1..-1].gsub(/[^#{PUNC.join}]/, ' ')
25
- lines << line[0] + line[1..-1].gsub(/#{PUNC.join("|")}/, '')
24
+ top = line[0] || ""
25
+ rest = line[1..-1] || ""
26
+ lines << rest.gsub(/[^#{PUNC.join}]/, ' ')
27
+ lines << top + rest.gsub(/#{PUNC.join("|")}/, '')
26
28
  }
27
29
 
28
30
  max = lines.map(&:size).max
@@ -3,8 +3,9 @@ require_relative 'spec_helper'
3
3
 
4
4
  describe Flippy do
5
5
  describe "#vertical" do
6
- subject { "こんにちはー、\n日本。".vertical }
7
- it { should eq <<-EOS.chomp }
6
+ context "with any strings" do
7
+ subject { "こんにちはー、\n日本。".vertical }
8
+ it { should eq <<-EOS.chomp }
8
9
  日 こ 
9
10
  本。ん 
10
11
    に 
@@ -12,5 +13,16 @@ describe Flippy do
12
13
    は 
13
14
    |、
14
15
  EOS
16
+ end
17
+
18
+ context "with empty strings" do
19
+ subject { "".vertical }
20
+ it { should eq "" }
21
+ end
22
+
23
+ context "with CR" do
24
+ subject { "\n".vertical }
25
+ it { should eq "" }
26
+ end
15
27
  end
16
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyoendo