auto-space 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/auto-space.rb +9 -3
- data/lib/auto-space/correct_words.rb +18 -0
- metadata +25 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfecf62c3c7a52cec9f62f91d45126c9e9c9adf3
|
4
|
+
data.tar.gz: ffe15e4384bce8fb436eceb0199ad9e9cb9df1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c4b5ebf40155db37b770c6a390a226646b849eb0af6b18b839d10a0daba52733d7ac7a05ffe4c6b5afc235b451e418802c85393e9a04400fef06173436d880
|
7
|
+
data.tar.gz: ca4c3d303f14326ff60178436593eb19761ad8b4a7a98ca1382a74cdd17f5d370138b181ff88446245c64fea4a3c0587c94bcd9e226c0a958146fa28eb503488
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
自动给中文英文之间加入合理的空格
|
4
4
|
|
5
|
+
- [](https://rubygems.org/gems/auto-space)
|
6
|
+
- [](http://travis-ci.org/huacnlee/auto-space)
|
8
|
+
|
5
9
|
## 例如
|
6
10
|
|
7
11
|
```irb
|
data/lib/auto-space.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
class String
|
2
|
+
class String
|
3
3
|
def auto_space!
|
4
|
-
self.gsub! /((?![年月日号])\p{Han})([a-zA-Z0-9
|
4
|
+
self.gsub! /((?![年月日号])\p{Han})([a-zA-Z0-9+$@#\[\(\/])/u do
|
5
5
|
"#$1 #$2"
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
|
+
self.gsub! /([a-zA-Z0-9+$\]\)@#!\/]|[\d[年月日]]{2,})((?![年月日号])\p{Han})/u do
|
8
9
|
"#$1 #$2"
|
9
10
|
end
|
11
|
+
|
10
12
|
self
|
11
13
|
end
|
14
|
+
|
15
|
+
def correct!
|
16
|
+
|
17
|
+
end
|
12
18
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module AutoSpace
|
2
|
+
class CorrectWords
|
3
|
+
class << self
|
4
|
+
def keywords
|
5
|
+
@keywords ||= %W(
|
6
|
+
GitHub MongoDB VIM Emacs MySQL PostgreSQL NoSQL MRI IT HR ENV GitLab API CNAME SQLite Git
|
7
|
+
Rails Ruby Assets Pipeline Bootstrap
|
8
|
+
JS JavaScript Ajax HTML CSS HTML5 CSS3 jQuery Node.js CoffeeScript SASS SCSS AngularJS
|
9
|
+
ActiveRecord ActiveSupport ActiveModel ActiveResource ActionController ActionView ERB
|
10
|
+
OAuth OAuth2 OpenSSL SSL
|
11
|
+
RubyMine RSpec mRuby RubyTuesday TextMate EventMachine RVM rbenv
|
12
|
+
CentOS RHEL UCloud
|
13
|
+
RubyConf RailsConf
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto-space
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luikore
|
@@ -9,9 +9,23 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 3.0.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 3.0.0
|
28
|
+
description: "自动给中文英文之间加入合理的空格"
|
15
29
|
email:
|
16
30
|
- usurffx@gmail.com
|
17
31
|
- huacnlee@gmail.com
|
@@ -19,8 +33,9 @@ executables: []
|
|
19
33
|
extensions: []
|
20
34
|
extra_rdoc_files: []
|
21
35
|
files:
|
22
|
-
- lib/auto-space.rb
|
23
36
|
- README.md
|
37
|
+
- lib/auto-space.rb
|
38
|
+
- lib/auto-space/correct_words.rb
|
24
39
|
homepage: https://github.com/huacnlee/auto-space
|
25
40
|
licenses: []
|
26
41
|
metadata: {}
|
@@ -30,18 +45,19 @@ require_paths:
|
|
30
45
|
- lib
|
31
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
47
|
requirements:
|
33
|
-
- -
|
48
|
+
- - ">="
|
34
49
|
- !ruby/object:Gem::Version
|
35
50
|
version: '0'
|
36
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
52
|
requirements:
|
38
|
-
- -
|
53
|
+
- - ">="
|
39
54
|
- !ruby/object:Gem::Version
|
40
55
|
version: '0'
|
41
56
|
requirements: []
|
42
57
|
rubyforge_project:
|
43
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.2.2
|
44
59
|
signing_key:
|
45
60
|
specification_version: 4
|
46
|
-
summary: 自动给中文英文之间加入合理的空格
|
61
|
+
summary: "自动给中文英文之间加入合理的空格"
|
47
62
|
test_files: []
|
63
|
+
has_rdoc:
|