mb_string 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +3 -0
- data/README.md +12 -0
- data/lib/mb_string/core_ext/string.rb +3 -3
- data/lib/mb_string/version.rb +1 -1
- data/mb_string.gemspec +4 -0
- metadata +45 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ccfcf29d9eaab3d640cf86f259840af10d25bb7
|
4
|
+
data.tar.gz: c24adadf3339fde649f2124e94aec8640b34799e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f06d77c5a9d4735a7698fdf444b21299f3c0fed592f85db283ed60810118195658b6888c8b7fd6539767d21886b5b6d446098d1a679b33fb102694af677397
|
7
|
+
data.tar.gz: 67d279e224ce53f1940865eb42151d79c2ed264b37b1970427007a67e29667c210da6ce8c84732653c4ecc288971143a63b58466249b1c58823078d01c9013d4
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,19 @@
|
|
1
|
+
[![Build Status](http://img.shields.io/travis/rochefort/mb_string.svg?style=flat)](http://travis-ci.org/rochefort/mb_string)
|
2
|
+
[![Dependency Status](http://img.shields.io/gemnasium/rochefort/mb_string.svg?style=flat)](https://gemnasium.com/rochefort/mb_string)
|
3
|
+
[![Coverage Status](http://img.shields.io/coveralls/rochefort/mb_string.svg?style=flat)](https://coveralls.io/r/rochefort/mb_string)
|
4
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/rochefort/mb_string.svg?style=flat)](https://codeclimate.com/github/rochefort/mb_string)
|
5
|
+
[![Gem Version](http://img.shields.io/gem/v/mb_string.svg?style=flat)](http://badge.fury.io/rb/mb_string)
|
6
|
+
|
7
|
+
|
1
8
|
# mb_string
|
2
9
|
|
3
10
|
`mb_string` is extended Ruby string class for dealing multi-byte strings, add `mb_ljust`, `mb_rjust`, `mb_center` and `mb_truncate` methods.
|
4
11
|
|
12
|
+
## Requirements
|
13
|
+
|
14
|
+
Ruby versions is earlier than 2.0.
|
15
|
+
|
16
|
+
|
5
17
|
## Installation
|
6
18
|
|
7
19
|
Add this line to your application's Gemfile:
|
@@ -1,21 +1,21 @@
|
|
1
1
|
require 'unicode/display_width'
|
2
|
-
# TODO: asciiかどうか判定する?
|
3
|
-
# TODO: circle ci
|
4
|
-
|
5
2
|
class String
|
6
3
|
def mb_ljust(width, pad_str = ' ')
|
4
|
+
return ljust(width, pad_str) if ascii_only? && pad_str.ascii_only?
|
7
5
|
mb_execute(width) do |pad_size|
|
8
6
|
self + mb_build_padding(pad_size, pad_str)
|
9
7
|
end
|
10
8
|
end
|
11
9
|
|
12
10
|
def mb_rjust(width, pad_str = ' ')
|
11
|
+
return rjust(width, pad_str) if ascii_only? && pad_str.ascii_only?
|
13
12
|
mb_execute(width) do |pad_size|
|
14
13
|
mb_build_padding(pad_size, pad_str, is_append_right: false) + self
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
def mb_center(width, pad_str = ' ')
|
18
|
+
return center(width, pad_str) if ascii_only? && pad_str.ascii_only?
|
19
19
|
mb_execute(width) do |pad_size|
|
20
20
|
left_pad_size = pad_size / 2
|
21
21
|
right_pad_size = pad_size - left_pad_size
|
data/lib/mb_string/version.rb
CHANGED
data/mb_string.gemspec
CHANGED
@@ -24,4 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
27
|
+
spec.add_development_dependency 'simplecov', '~> 0.11.0'
|
28
|
+
|
29
|
+
spec.add_development_dependency 'coveralls'
|
30
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
27
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mb_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rochefort
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode-display_width
|
@@ -66,6 +66,48 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.11.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.11.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: codeclimate-test-reporter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
69
111
|
description: You can use mb_ljust, mb_rjust, mb_center for multibyte strings.
|
70
112
|
email:
|
71
113
|
- terasawan@gmail.com
|
@@ -73,6 +115,7 @@ executables: []
|
|
73
115
|
extensions: []
|
74
116
|
extra_rdoc_files: []
|
75
117
|
files:
|
118
|
+
- ".coveralls.yml"
|
76
119
|
- ".gitignore"
|
77
120
|
- ".rspec"
|
78
121
|
- ".travis.yml"
|