auto-space 0.0.1

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.
Files changed (3) hide show
  1. data/README.md +18 -0
  2. data/lib/auto-space.rb +12 -0
  3. metadata +49 -0
@@ -0,0 +1,18 @@
1
+ # auto-space
2
+
3
+ 自动给中文英文之间加入合理的空格
4
+
5
+ ## 例如
6
+
7
+ ```irb
8
+ irb> require 'auto-space'
9
+ true
10
+ irb> "关于 SSH连接的Permission denied (publickey).".auto_space!
11
+ 关于 SSH 连接的 Permission denied (publickey).
12
+ irb> "怎样追踪一个 repo的新feature 和进展呢?".auto_space!
13
+ 怎样追踪一个 repo 的新 feature 和进展呢?
14
+ irb> "vps上sessions不生效,但在本地的环境是ok的,why?".auto_space!
15
+ vps 上 sessions 不生效,但在本地的环境是 OK 的,why?
16
+ irb> "bootstrap control-group对齐问题".auto_space!
17
+ bootstrap control-group 对齐问
18
+ ```
@@ -0,0 +1,12 @@
1
+ # coding: utf-8
2
+ class String
3
+ def auto_space!
4
+ self.gsub! /((?![年月日])\p{Han})([a-zA-Z0-9@#\/])/u do
5
+ "#$1 #$2"
6
+ end
7
+ self.gsub! /([a-zA-Z0-9@#!\/]|[\d[年月日]])((?![年月日])\p{Han})/u do
8
+ "#$1 #$2"
9
+ end
10
+ self
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto-space
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Luikore
9
+ - Jason Lee
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-06-14 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: 自动给中文英文之间加入合理的空格
16
+ email:
17
+ - usurffx@gmail.com
18
+ - huacnlee@gmail.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - lib/auto-space.rb
24
+ - README.md
25
+ homepage: https://github.com/huacnlee/auto-space
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ none: false
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.24
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: 自动给中文英文之间加入合理的空格
49
+ test_files: []