pebbles-totsugen 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: a8f93243130a7a0a56e9ce5066636a8a7a250e0de930867b93cdcf3c5caf1cbf
4
- data.tar.gz: 8556339e745eb4d1b95b202bf18820db81f49e110c946c21bcb46c5ec93d675f
3
+ metadata.gz: 8a68739aed560d75f388e74e566a9a055050ff491655dd76b1ee36bacc965d19
4
+ data.tar.gz: a0fe16a797f52b7f3cd28eb48c3f80a4e1679c3b1cb7eb12f4ffb31ea0818918
5
5
  SHA512:
6
- metadata.gz: a81abe2b3be3af21fc967380e0da2244e07747e6a970aa7b6d2c7582a482d97abd06b4ede70ed4d87a5e7e5fa53d2e340a15f2d8952cae0281cf4cde62de40c7
7
- data.tar.gz: b87b0833e40cb9fd517895d2d88f8f9301714de5bae04c220c7c35913b3e2983ee4a3c4af08e617540534e3dad8f11ff7fdfcf27e13dce538074f7a4c64df5ba
6
+ metadata.gz: b9930de0d2224ec279f08d5e585129f092518e3b38911b0fbbf63c821f47cbf9d9e725714c1c49d1bf005502267cd16dca9dccbf4b1f5f6cea238138d6844370
7
+ data.tar.gz: c7f7a5454de549ff66c3ad6ff003e68b4c0f64a4df559434bfcda485e6bde0d6788c8d58d4f0212969a8013e9064d6b85472b285b8f5bd7f29bdcd151b0cefd9
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2013 Kenichi Kamiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,11 +1,9 @@
1
- pebbles-totsugen
2
- ================
1
+ # pebbles-totsugen
3
2
 
4
- [![Build Status](https://secure.travis-ci.org/kachick/pebbles-totsugen.png)](http://travis-ci.org/kachick/pebbles-totsugen)
3
+ ![Build Status](https://github.com/kachick/pebbles-totsugen/actions/workflows/test_behaviors.yml/badge.svg?branch=main)
5
4
  [![Gem Version](https://badge.fury.io/rb/pebbles-totsugen.png)](http://badge.fury.io/rb/pebbles-totsugen)
6
5
 
7
- なにこれ
8
- -----------
6
+ ## なにこれ
9
7
 
10
8
  ```plaintext
11
9
  _人人人人人人人人人_
@@ -13,15 +11,21 @@ pebbles-totsugen
13
11
   ̄Y^Y^Y^Y^Y^Y^Y^Y ̄
14
12
  ```
15
13
 
16
- 使い方
17
- -----
14
+ ## 使い方
15
+
16
+ Ruby 2.6 以上 でテストしています。
17
+
18
+ ```console
19
+ $ gem install pebbles-totsugen
20
+ これで `totsugen.rb` というのが $PATH に入ります。やばいですね。
21
+ ```
18
22
 
19
23
  ### ターミナルから
20
24
 
21
25
  引数で渡したり
22
26
 
23
- ```bash
24
- $ totsugen 突然の死
27
+ ```console
28
+ $ totsugen.rb 突然の死
25
29
  _人人人人人人_
26
30
  > 突然の死 <
27
31
   ̄Y^Y^Y^Y^Y ̄
@@ -29,8 +33,8 @@ $ totsugen 突然の死
29
33
 
30
34
  標準入力で渡したり
31
35
 
32
- ```bash
33
- $ echo '突然のSTDIN' | totsugen
36
+ ```console
37
+ $ echo '突然のSTDIN' | totsugen.rb
34
38
  _人人人人人人人_
35
39
  > 突然のSTDIN <
36
40
   ̄Y^Y^Y^Y^Y^Y ̄
@@ -47,31 +51,8 @@ Pebbles::TotsuGen.generate('突然のrequire') #=> _人人人人人人人人
47
51
 
48
52
  ```
49
53
 
50
- 動作環境
51
- -------------
52
-
53
- * Ruby - [2.5以上](http://travis-ci.org/#!/kachick/pebbles-totsugen)
54
-
55
- Install
56
- -------
57
-
58
- ```bash
59
- $ gem install pebbles-totsugen
60
- ```
61
-
62
- Link
63
- ----
64
-
65
- * [Home](http://kachick.github.com/pebbles-totsugen/)
66
- * [code](https://github.com/kachick/pebbles-totsugen)
67
- * [API](http://kachick.github.com/pebbles-totsugen/yard/frames.html)
68
- * [issues](https://github.com/kachick/pebbles-totsugen/issues)
69
- * [CI](http://travis-ci.org/#!/kachick/pebbles-totsugen)
70
- * [gem](https://rubygems.org/gems/pebbles-totsugen)
71
-
72
- お決まりのライセンス
73
- --------
54
+ ## リンク
74
55
 
75
- The MIT X11 License
76
- Copyright (c) 2013 Kenichi Kamiya
77
- See MIT-LICENSE for further details.
56
+ * [ソースコード](https://github.com/kachick/pebbles-totsugen)
57
+ * [APIドキュメント](https://kachick.github.io/pebbles-totsugen/)
58
+ * [`pebbles` とはなにか](https://randd.kwappa.net/2010/12/19/192/)
data/exe/totsugen.rb ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ # frozen_string_literal: true
4
+
5
+ require_relative '../lib/pebbles/totsugen'
6
+
7
+ usage =<<"USAGE"
8
+ #{$PROGRAM_NAME} - `突然のほにゃほにゃ` ジェネレーター
9
+
10
+ 1. from $1
11
+ $ #{$PROGRAM_NAME} 突然の死
12
+
13
+ 2. from STDIN
14
+ $ echo '突然の死' | #{$PROGRAM_NAME}
15
+ USAGE
16
+
17
+ case ARGV.length
18
+ when 0
19
+ puts Pebbles::TotsuGen.generate(gets.chomp)
20
+ when 1
21
+ puts Pebbles::TotsuGen.generate(ARGV.shift)
22
+ else
23
+ abort(usage)
24
+ end
@@ -1,4 +1,6 @@
1
1
  # coding: us-ascii
2
+ # frozen_string_literal: true
3
+
2
4
  # Copyright (c) 2013 Kenichi Kamiya
3
5
 
4
6
  module Pebbles
@@ -8,4 +10,4 @@ end
8
10
 
9
11
  require_relative 'totsugen/version'
10
12
  require_relative 'totsugen/formatters'
11
- require_relative 'totsugen/singleton_class'
13
+ require_relative 'totsugen/singleton_class'
@@ -1,73 +1,74 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
- module Pebbles::TotsuGen
4
+ module Pebbles
5
+ module TotsuGen
6
+ class Formatter
7
+ def initialize(body)
8
+ @body = body
9
+ end
4
10
 
5
- class Formatter
6
- def initialize(body)
7
- @body = body
8
- end
9
-
10
- def result
11
- "#{header}\n#{center}\n#{footer}"
12
- end
13
-
14
- private
15
-
16
- def body_length
17
- @body.each_char.inject(0){|total, char|total += char.bytesize == 1 ? 1 : 2}
18
- end
19
-
20
- def header
21
- "_#{body_top}_"
22
- end
11
+ def result
12
+ "#{header}\n#{center}\n#{footer}"
13
+ end
23
14
 
24
- def footer
25
- " ̄#{body_bottom} ̄"
26
- end
27
- end
15
+ private
28
16
 
29
- # なんか、元々はこういうフォーマットだったっぽいので一応実装しておいた。
30
- class OriginFormatter < Formatter
31
- private
32
-
33
- def center
34
- "> #{@body} <"
35
- end
17
+ def body_length
18
+ @body.each_char.sum { |char| (char.bytesize == 1) ? 1 : 2 }
19
+ end
36
20
 
37
- def body_top
38
- half = '人' * ((body_length / 2) / 2)
39
- shortage = body_length % 4
40
- padding = case shortage
41
- when 3, 2
42
- '人'
43
- when 1
44
- ''
45
- when 0
46
- ' '
47
- end
21
+ def header
22
+ "_#{body_top}_"
23
+ end
48
24
 
49
- "#{half}#{padding}#{half}"
25
+ def footer
26
+ " ̄#{body_bottom} ̄"
27
+ end
50
28
  end
51
29
 
52
- def body_bottom
53
- ('Y^' * (body_length / 2)).chop
30
+ # なんか、元々はこういうフォーマットだったっぽいので一応実装しておいた。
31
+ class OriginFormatter < Formatter
32
+ private
33
+
34
+ def center
35
+ "> #{@body} <"
36
+ end
37
+
38
+ def body_top
39
+ half = '人' * ((body_length / 2) / 2)
40
+ shortage = body_length % 4
41
+ padding = case shortage
42
+ when 3, 2
43
+ '人'
44
+ when 1
45
+ ''
46
+ when 0
47
+ ' '
48
+ end
49
+
50
+ "#{half}#{padding}#{half}"
51
+ end
52
+
53
+ def body_bottom
54
+ ('Y^' * (body_length / 2)).chop
55
+ end
54
56
  end
55
- end
56
57
 
57
- class SimplifiedFormatter < Formatter
58
- private
58
+ class SimplifiedFormatter < Formatter
59
+ private
59
60
 
60
- def center
61
- "> #{@body} <"
62
- end
61
+ def center
62
+ "> #{@body} <"
63
+ end
63
64
 
64
- def body_top
65
- '人' * ((body_length / 2) + 2)
66
- end
65
+ def body_top
66
+ '人' * ((body_length / 2) + 2)
67
+ end
67
68
 
68
- def body_bottom
69
- ('Y^' * ((body_length / 2) + 1)).chop
69
+ def body_bottom
70
+ ('Y^' * ((body_length / 2) + 1)).chop
71
+ end
70
72
  end
71
73
  end
72
-
73
- end
74
+ end
@@ -1,12 +1,15 @@
1
1
  # coding: us-ascii
2
+ # frozen_string_literal: true
2
3
 
3
- module Pebbles::TotsuGen; class << self
4
-
5
- # @param body [String, #to_str]
6
- # @return [String]
7
- def generate(body)
8
- formatter = SimplifiedFormatter.new body.to_str
9
- formatter.result
4
+ module Pebbles
5
+ module TotsuGen
6
+ class << self
7
+ # @param body [String, #to_str]
8
+ # @return [String]
9
+ def generate(body)
10
+ formatter = SimplifiedFormatter.new(body.to_str)
11
+ formatter.result
12
+ end
13
+ end
10
14
  end
11
-
12
- end; end
15
+ end
@@ -1,5 +1,8 @@
1
1
  # coding: us-ascii
2
+ # frozen_string_literal: true
2
3
 
3
- module Pebbles::TotsuGen
4
- VERSION = '0.1.0'.freeze
5
- end
4
+ module Pebbles
5
+ module TotsuGen
6
+ VERSION = '0.2.0'
7
+ end
8
+ end
metadata CHANGED
@@ -1,122 +1,39 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebbles-totsugen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Kamiya
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-08 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rspec
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '3.8'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '4'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '3.8'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '4'
33
- - !ruby/object:Gem::Dependency
34
- name: yard
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 0.9.20
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '2'
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 0.9.20
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '2'
53
- - !ruby/object:Gem::Dependency
54
- name: rake
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '10'
60
- - - "<"
61
- - !ruby/object:Gem::Version
62
- version: '20'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '10'
70
- - - "<"
71
- - !ruby/object:Gem::Version
72
- version: '20'
73
- - !ruby/object:Gem::Dependency
74
- name: bundler
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: '2'
80
- - - "<"
81
- - !ruby/object:Gem::Version
82
- version: '3'
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '2'
90
- - - "<"
91
- - !ruby/object:Gem::Version
92
- version: '3'
93
- description: totsuzenno generator!!
11
+ date: 2021-06-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: " `突然のほにゃほにゃ` ジェネレーター\n"
94
14
  email:
95
15
  - kachick1+ruby@gmail.com
96
16
  executables:
97
- - totsugen
17
+ - totsugen.rb
98
18
  extensions: []
99
19
  extra_rdoc_files: []
100
20
  files:
101
- - ".gitignore"
102
- - ".travis.yml"
103
- - ".yardopts"
104
- - Gemfile
21
+ - MIT-LICENSE.txt
105
22
  - README.md
106
- - Rakefile
107
- - bin/totsugen
23
+ - exe/totsugen.rb
108
24
  - lib/pebbles/totsugen.rb
109
25
  - lib/pebbles/totsugen/formatters.rb
110
26
  - lib/pebbles/totsugen/singleton_class.rb
111
27
  - lib/pebbles/totsugen/version.rb
112
- - pebbles-totsugen.gemspec
113
- - spec/helper.rb
114
- - spec/pebbles-totsugen_spec.rb
115
- homepage: http://kachick.github.com/pebbles-totsugen/
28
+ homepage: https://github.com/kachick/pebbles-totsugen
116
29
  licenses:
117
30
  - MIT
118
- metadata: {}
119
- post_install_message:
31
+ metadata:
32
+ documentation_uri: https://kachick.github.io/pebbles-totsugen/
33
+ homepage_uri: https://github.com/kachick/pebbles-totsugen
34
+ source_code_uri: https://github.com/kachick/pebbles-totsugen
35
+ bug_tracker_uri: https://github.com/kachick/pebbles-totsugen/issues
36
+ post_install_message:
120
37
  rdoc_options: []
121
38
  require_paths:
122
39
  - lib
@@ -124,18 +41,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
41
  requirements:
125
42
  - - ">="
126
43
  - !ruby/object:Gem::Version
127
- version: '0'
44
+ version: 2.6.0
128
45
  required_rubygems_version: !ruby/object:Gem::Requirement
129
46
  requirements:
130
47
  - - ">="
131
48
  - !ruby/object:Gem::Version
132
49
  version: '0'
133
50
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.7.6
136
- signing_key:
51
+ rubygems_version: 3.2.15
52
+ signing_key:
137
53
  specification_version: 4
138
- summary: totsuzenno generator!!
139
- test_files:
140
- - spec/helper.rb
141
- - spec/pebbles-totsugen_spec.rb
54
+ summary: "`突然のほにゃほにゃ` ジェネレーター"
55
+ test_files: []
data/.gitignore DELETED
@@ -1,38 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .DS_Store
6
- .ruby-version
7
- coverage
8
- coverage.data
9
- InstalledFiles
10
- lib/bundler/man
11
- pkg
12
- rdoc
13
- spec/reports
14
- test/tmp
15
- test/version_tmp
16
- tmp
17
-
18
- # bundler
19
- vendor/
20
-
21
- # YARD artifacts
22
- .yardoc
23
- _yardoc
24
- doc/
25
-
26
- # tmp-old
27
- .old
28
-
29
- # editor
30
- *~
31
- .redcar
32
-
33
- # other
34
- *.lock
35
- *.bak
36
- tool/
37
- .rbx/
38
- *\#*
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - ruby-head
5
- - 2.6
6
- - 2.5
7
- - rbx-4
8
- - jruby-head
9
-
10
- matrix:
11
- allow_failures:
12
- - rvm: ruby-head
13
- - rvm: rbx-4
14
- - rvm: jruby-head
15
-
16
- before_install:
17
- - gem install bundler
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- --readme README.md lib/**/*.rb
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'rake'
7
- end
8
-
9
- group :test do
10
- gem 'rake'
11
- end
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
-
4
- require 'rspec/core/rake_task'
5
-
6
- task default: [:spec]
7
-
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = 'spec/**/*_spec.rb'
10
- t.ruby_opts = %w[-w]
11
- end
data/bin/totsugen DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # coding: utf-8
3
-
4
- require_relative '../lib/pebbles/totsugen'
5
-
6
- include Pebbles
7
-
8
- usage =<<"EOS"
9
- #{$PROGRAM_NAME} - 突然のほにゃほにゃジェネレータ
10
-
11
- 1. from $1
12
- $ #{$PROGRAM_NAME} 突然の死
13
-
14
- 2. from STDIN
15
- $ echo '突然の死' | #{$PROGRAM_NAME}
16
- EOS
17
-
18
- case ARGV.length
19
- when 0
20
- puts TotsuGen.generate(gets.chomp)
21
- when 1
22
- puts TotsuGen.generate(ARGV.shift)
23
- else
24
- abort usage
25
- end
@@ -1,27 +0,0 @@
1
- require './lib/pebbles/totsugen'
2
-
3
- Gem::Specification.new do |gem|
4
- # specific
5
-
6
- gem.description = %q{totsuzenno generator!!}
7
-
8
- gem.summary = gem.description.dup
9
- gem.homepage = 'http://kachick.github.com/pebbles-totsugen/'
10
- gem.license = 'MIT'
11
- gem.name = 'pebbles-totsugen'
12
- gem.version = Pebbles::TotsuGen::VERSION.dup
13
-
14
- gem.add_development_dependency 'rspec', '>= 3.8', '< 4'
15
- gem.add_development_dependency 'yard', '>= 0.9.20', '< 2'
16
- gem.add_development_dependency 'rake', '>= 10', '< 20'
17
- gem.add_development_dependency 'bundler', '>= 2', '< 3'
18
-
19
- # common
20
-
21
- gem.authors = ['Kenichi Kamiya']
22
- gem.email = ['kachick1+ruby@gmail.com']
23
- gem.files = `git ls-files`.split($\)
24
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
25
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
26
- gem.require_paths = ['lib']
27
- end
data/spec/helper.rb DELETED
@@ -1,5 +0,0 @@
1
- # coding: us-ascii
2
-
3
- require 'rspec'
4
-
5
- require_relative '../lib/pebbles/totsugen'
@@ -1,100 +0,0 @@
1
- # coding: utf-8
2
-
3
- require_relative 'helper'
4
-
5
- describe Pebbles::TotsuGen do
6
- context '.generate' do
7
- it "簡易フォーマットを返す" do
8
- str = Pebbles::TotsuGen::SimplifiedFormatter.new('突然の死').result
9
- expect(Pebbles::TotsuGen.generate('突然の死')).to eq(str)
10
- end
11
- end
12
- end
13
-
14
- describe Pebbles::TotsuGen::OriginFormatter do
15
- let(:generator) {Pebbles::TotsuGen::OriginFormatter}
16
-
17
- context '#result' do
18
- context '引数を突然のほにゃほにゃフォーマットにして返せるよねーっていう' do
19
- specify '基本型として、「突然の死」をうまいこと片付ける' do
20
- str = <<'EOS'
21
- _人人 人人_
22
- > 突然の死 <
23
-  ̄Y^Y^Y^Y ̄
24
- EOS
25
- expect(generator.new('突然の死').result).to eq(str.chomp)
26
- end
27
-
28
- specify '基本型から1文字増えてもうまいことやる' do
29
- str = <<'EOS'
30
- _人人人人人_
31
- > 突然の昼寝 <
32
-  ̄Y^Y^Y^Y^Y ̄
33
- EOS
34
- expect(generator.new('突然の昼寝').result).to eq(str.chomp)
35
- end
36
-
37
- specify '基本型から1文字減ってもうまいことやる' do
38
- str = <<'EOS'
39
- _人人人_
40
- > うだー <
41
-  ̄Y^Y^Y ̄
42
- EOS
43
- expect(generator.new('うだー').result).to eq(str.chomp)
44
- end
45
-
46
- specify '1byte文字と2byte文字混じってる時にもうまいことやっつける' do
47
- str = <<'EOS'
48
- _人人人人人_
49
- > 突然のRuby <
50
-  ̄Y^Y^Y^Y^Y ̄
51
- EOS
52
- expect(generator.new('突然のRuby').result).to eq(str.chomp)
53
- end
54
- end
55
- end
56
- end
57
-
58
- describe Pebbles::TotsuGen::SimplifiedFormatter do
59
- let(:generator) {Pebbles::TotsuGen::SimplifiedFormatter}
60
-
61
- context '#result' do
62
- context '引数を突然のほにゃほにゃフォーマットにして返せるよねーっていう' do
63
- specify '基本型として、「突然の死」をうまいこと片付ける' do
64
- str = <<'EOS'
65
- _人人人人人人_
66
- > 突然の死 <
67
-  ̄Y^Y^Y^Y^Y ̄
68
- EOS
69
- expect(generator.new('突然の死').result).to eq(str.chomp)
70
- end
71
-
72
- specify '基本型から1文字増えてもうまいことやる' do
73
- str = <<'EOS'
74
- _人人人人人人人_
75
- > 突然の昼寝 <
76
-  ̄Y^Y^Y^Y^Y^Y ̄
77
- EOS
78
- expect(generator.new('突然の昼寝').result).to eq(str.chomp)
79
- end
80
-
81
- specify '基本型から1文字減ってもうまいことやる' do
82
- str = <<'EOS'
83
- _人人人人人_
84
- > うだー <
85
-  ̄Y^Y^Y^Y ̄
86
- EOS
87
- expect(generator.new('うだー').result).to eq(str.chomp)
88
- end
89
-
90
- specify '1byte文字と2byte文字混じってる時にもうまいことやっつける' do
91
- str = <<'EOS'
92
- _人人人人人人人_
93
- > 突然のRuby <
94
-  ̄Y^Y^Y^Y^Y^Y ̄
95
- EOS
96
- expect(generator.new('突然のRuby').result).to eq(str.chomp)
97
- end
98
- end
99
- end
100
- end