kosi 0.0.1 → 0.0.2

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: 9b938040434b75078bdccb23b65954e2307d248d
4
- data.tar.gz: 1acde4a7534f0279db675b1800fbbfd59bd405d2
3
+ metadata.gz: 81b6af7fc9f98bd40c313d725b1108bad80aca5c
4
+ data.tar.gz: d325142941f583225c85f82391f6bc1fc2f98094
5
5
  SHA512:
6
- metadata.gz: c9f8b2329f4d8ef714a28f74d763ae3b4b494dfbf7d232c53b01635fb90dd8f2e640aad0aa22d4ada7110ec8df820a35fa5bc321071da76a3c77d9731d71141c
7
- data.tar.gz: c18678aa7bb8a88f09682659871615d87b591a17085d2ce074bf6a12a07ba6d7b0484bbc827c6a3c6eca7fa8052627b4b91c57b030331b626fc4a8039b4a988a
6
+ metadata.gz: 36da7e4271b166b40c978c95688c4683103c06f7ff494eabe3c2072eb72ac2bfbb7cae37c39cdc0eb1458523be66a64be84e29000467303c0f85628c3315ccb5
7
+ data.tar.gz: c34bf70484a25916f44b920548a845ba6e77b87fad82b27f50340c7500c794cc07101ab187e54bddee4073421ef743e0ff9fe70780afe8cb44ba7e178a1d2b28
@@ -1 +1 @@
1
- service_name: travis-ci
1
+ service_name: travis-ci
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
2
- --format progress
1
+ --color
2
+ --format progress
@@ -1,12 +1,12 @@
1
- AllCops:
2
- Exclude:
3
- - !ruby/regexp /spec\/*\.rb$/
4
-
5
- AsciiComments:
6
- Enabled: false
7
-
8
- RegexpLiteral:
9
- MaxSlashes: 0
10
-
11
- ClassLength:
1
+ AllCops:
2
+ Exclude:
3
+ - !ruby/regexp /spec\/*\.rb$/
4
+
5
+ AsciiComments:
6
+ Enabled: false
7
+
8
+ RegexpLiteral:
9
+ MaxSlashes: 0
10
+
11
+ ClassLength:
12
12
  Max: 150
@@ -1,8 +1,8 @@
1
- language: ruby
2
- before_install:
3
- - gem update --system 2.1.11
4
- - gem --version
5
- rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system 2.1.11
4
+ - gem --version
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
- gem "rspec", "~> 2.14.1"
5
- gem "thor", "~> 0.18.1"
6
- gem "simplecov", "~> 0.8.2"
7
- gem "activesupport", "~> 4.0.1"
8
- gem "activemodel", "~> 4.0.2"
9
- gem "tudu", "~> 0.0.4"
10
- group :test do
11
- gem 'coveralls', require: false
12
- end
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem "rspec", "~> 2.14.1"
5
+ gem "thor", "~> 0.18.1"
6
+ gem "simplecov", "~> 0.8.2"
7
+ gem "activesupport", "~> 4.0.1"
8
+ gem "activemodel", "~> 4.0.2"
9
+ gem "tudu", "~> 0.0.4"
10
+ group :test do
11
+ gem 'coveralls', require: false
12
+ end
data/README.md CHANGED
@@ -279,7 +279,8 @@ x*******x*******x*******x
279
279
 
280
280
  ## History
281
281
 
282
- version 0.0.1 : first release
282
+ * version 0.0.2 : ANSI Escape Sequence利用時にフォーマットが崩れないように変更
283
+ * version 0.0.1 : first release
283
284
 
284
285
  ## Contributing
285
286
 
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core'
3
- require 'rspec/core/rake_task'
4
- task default: [:spec]
5
-
6
- RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = 'spec/**/*_spec.rb'
8
- end
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ task default: [:spec]
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ end
@@ -1,28 +1,28 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'kosi/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'kosi'
8
- spec.version = Kosi::VERSION
9
- spec.authors = ['tbpgr']
10
- spec.email = ['tbpgr@tbpgr.jp']
11
- spec.summary = %q(terminal table format for japanese)
12
- spec.description = %q(terminal table format for japanese)
13
- spec.homepage = 'https://github.com/tbpgr/kosi'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_runtime_dependency 'activesupport', '~> 4.0.1'
22
- spec.add_runtime_dependency 'activemodel', '~> 4.0.2'
23
-
24
- spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'rake'
26
- spec.add_development_dependency 'rspec', '~> 2.14.1'
27
- spec.add_development_dependency 'simplecov', '~> 0.8.2'
28
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kosi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kosi'
8
+ spec.version = Kosi::VERSION
9
+ spec.authors = ['tbpgr']
10
+ spec.email = ['tbpgr@tbpgr.jp']
11
+ spec.summary = %q(terminal table format for japanese)
12
+ spec.description = %q(terminal table format for japanese)
13
+ spec.homepage = 'https://github.com/tbpgr/kosi'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'activesupport', '~> 4.0.1'
22
+ spec.add_runtime_dependency 'activemodel', '~> 4.0.2'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '~> 2.14.1'
27
+ spec.add_development_dependency 'simplecov', '~> 0.8.2'
28
+ end
@@ -1,13 +1,13 @@
1
- # encoding: utf-8
2
- require 'kosi/align'
3
- require 'kosi/connector_char'
4
- require 'kosi/header'
5
- require 'kosi/horizontal_border_char'
6
- require 'kosi/options'
7
- require 'kosi/separate_each_row'
8
- require 'kosi/vertical_border_char'
9
- require 'table'
10
-
11
- # TableFormat for Terminal(Use Japanese Charactors)
12
- module Kosi
13
- end
1
+ # encoding: utf-8
2
+ require 'kosi/align'
3
+ require 'kosi/connector_char'
4
+ require 'kosi/header'
5
+ require 'kosi/horizontal_border_char'
6
+ require 'kosi/options'
7
+ require 'kosi/separate_each_row'
8
+ require 'kosi/vertical_border_char'
9
+ require 'table'
10
+
11
+ # TableFormat for Terminal(Use Japanese Charactors)
12
+ module Kosi
13
+ end
@@ -1,33 +1,33 @@
1
- # encoding: utf-8
2
- require 'kosi/options'
3
-
4
- # TableFormat for Terminal(Use Japanese Charactors)
5
- module Kosi
6
- # Align
7
- class Align
8
- attr_reader :value
9
- # Align Type
10
- module TYPE
11
- CENTER = :center
12
- RIGHT = :right
13
- LEFT = :left
14
- DEFAULT = LEFT
15
- end
16
-
17
- def initialize(options)
18
- @value = options[OptionKeys::ALIGN] || TYPE::DEFAULT
19
- end
20
-
21
- def apply(text, max_value, diff)
22
- pos = max_value - diff
23
- case @value
24
- when TYPE::CENTER
25
- text.center(pos)
26
- when TYPE::RIGHT
27
- text.rjust(pos)
28
- when TYPE::LEFT
29
- text.ljust(pos)
30
- end
31
- end
32
- end
33
- end
1
+ # encoding: utf-8
2
+ require 'kosi/options'
3
+
4
+ # TableFormat for Terminal(Use Japanese Charactors)
5
+ module Kosi
6
+ # Align
7
+ class Align
8
+ attr_reader :value
9
+ # Align Type
10
+ module TYPE
11
+ CENTER = :center
12
+ RIGHT = :right
13
+ LEFT = :left
14
+ DEFAULT = LEFT
15
+ end
16
+
17
+ def initialize(options)
18
+ @value = options[OptionKeys::ALIGN] || TYPE::DEFAULT
19
+ end
20
+
21
+ def apply(text, max_value, diff)
22
+ pos = max_value - diff
23
+ case @value
24
+ when TYPE::CENTER
25
+ text.center(pos)
26
+ when TYPE::RIGHT
27
+ text.rjust(pos)
28
+ when TYPE::LEFT
29
+ text.ljust(pos)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,17 +1,17 @@
1
- require 'kosi/options'
2
-
3
- # TableFormat for Terminal(Use Japanese Charactors)
4
- module Kosi
5
- # CharOption
6
- class CharOption
7
- attr_reader :value
8
-
9
- def initialize(options)
10
- @value = String(options[key])
11
- @value = default if @value.empty?
12
- unless @value.size == 1
13
- fail ArgumentError, format(invalid_char_msg, @value.size, @value)
14
- end
15
- end
16
- end
17
- end
1
+ require 'kosi/options'
2
+
3
+ # TableFormat for Terminal(Use Japanese Charactors)
4
+ module Kosi
5
+ # CharOption
6
+ class CharOption
7
+ attr_reader :value
8
+
9
+ def initialize(options)
10
+ @value = String(options[key])
11
+ @value = default if @value.empty?
12
+ unless @value.size == 1
13
+ fail ArgumentError, format(invalid_char_msg, @value.size, @value)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,26 +1,26 @@
1
- require 'kosi/options'
2
- require 'kosi/char_option'
3
-
4
- # TableFormat for Terminal(Use Japanese Charactors)
5
- module Kosi
6
- # ConnectorChar
7
- class ConnectorChar < CharOption
8
- DEFAULT = '+'
9
- INVALID_CHAR_MSG = \
10
- 'connector char must be 1 length(%d) char %s'
11
-
12
- def default
13
- DEFAULT
14
- end
15
-
16
- def key
17
- OptionKeys::CONNECTOR_CHAR
18
- end
19
-
20
- private
21
-
22
- def invalid_char_msg
23
- INVALID_CHAR_MSG
24
- end
25
- end
26
- end
1
+ require 'kosi/options'
2
+ require 'kosi/char_option'
3
+
4
+ # TableFormat for Terminal(Use Japanese Charactors)
5
+ module Kosi
6
+ # ConnectorChar
7
+ class ConnectorChar < CharOption
8
+ DEFAULT = '+'
9
+ INVALID_CHAR_MSG = \
10
+ 'connector char must be 1 length(%d) char %s'
11
+
12
+ def default
13
+ DEFAULT
14
+ end
15
+
16
+ def key
17
+ OptionKeys::CONNECTOR_CHAR
18
+ end
19
+
20
+ private
21
+
22
+ def invalid_char_msg
23
+ INVALID_CHAR_MSG
24
+ end
25
+ end
26
+ end
@@ -1,18 +1,18 @@
1
- # encoding: utf-8
2
- require 'kosi/options'
3
-
4
- # TableFormat for Terminal(Use Japanese Charactors)
5
- module Kosi
6
- # Header
7
- class Header
8
- attr_reader :value
9
-
10
- def initialize(options)
11
- @value = options[OptionKeys::HEADER]
12
- end
13
-
14
- def empty?
15
- @value.nil?
16
- end
17
- end
18
- end
1
+ # encoding: utf-8
2
+ require 'kosi/options'
3
+
4
+ # TableFormat for Terminal(Use Japanese Charactors)
5
+ module Kosi
6
+ # Header
7
+ class Header
8
+ attr_reader :value
9
+
10
+ def initialize(options)
11
+ @value = options[OptionKeys::HEADER]
12
+ end
13
+
14
+ def empty?
15
+ @value.nil?
16
+ end
17
+ end
18
+ end
@@ -1,26 +1,26 @@
1
- require 'kosi/options'
2
- require 'kosi/char_option'
3
-
4
- # TableFormat for Terminal(Use Japanese Charactors)
5
- module Kosi
6
- # HorizontalBorderChar
7
- class HorizontalBorderChar < CharOption
8
- DEFAULT = '-'
9
- INVALID_CHAR_MSG = \
10
- 'horizontal_border_char must be 1 length(%d) char %s'
11
-
12
- def default
13
- DEFAULT
14
- end
15
-
16
- def key
17
- OptionKeys::HORIZONTAL_BORDER_CHAR
18
- end
19
-
20
- private
21
-
22
- def invalid_char_msg
23
- INVALID_CHAR_MSG
24
- end
25
- end
26
- end
1
+ require 'kosi/options'
2
+ require 'kosi/char_option'
3
+
4
+ # TableFormat for Terminal(Use Japanese Charactors)
5
+ module Kosi
6
+ # HorizontalBorderChar
7
+ class HorizontalBorderChar < CharOption
8
+ DEFAULT = '-'
9
+ INVALID_CHAR_MSG = \
10
+ 'horizontal_border_char must be 1 length(%d) char %s'
11
+
12
+ def default
13
+ DEFAULT
14
+ end
15
+
16
+ def key
17
+ OptionKeys::HORIZONTAL_BORDER_CHAR
18
+ end
19
+
20
+ private
21
+
22
+ def invalid_char_msg
23
+ INVALID_CHAR_MSG
24
+ end
25
+ end
26
+ end