depcon 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/depcon.gemspec +28 -0
- data/lib/depcon.rb +26 -0
- data/lib/depcon/version.rb +3 -0
- data/lib/dictionary.yml +67 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e271e949522710ea6f1ec547251cb3d25a2ca92
|
4
|
+
data.tar.gz: 12afbf8f2563751b72b100092c6d6d7565549c89
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e27e1b598cf9ffd62ab9d67a1798eb1ed7b7ee4bac47f5176a5e4f86cae8493e851bc7d1aa4396452234f4b08ac6dff0ff2fd4cf5e60267675b68a4a9558ff0
|
7
|
+
data.tar.gz: 911c477b3a888c3499f243aecc77ae74dca5e6c96c5117115467e23a9ad5c33742049f62e8128c491a997ace063b343fbaffcfdf2065dffc04d4122b0676dbfc
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Depcon
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/t4traw/depcon.svg?branch=master)](https://travis-ci.org/t4traw/depcon)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/t4traw/depcon/badges/gpa.svg)](https://codeclimate.com/github/t4traw/depcon)
|
5
|
+
|
6
|
+
よく使われる機種依存文字をよしなに変換してくれる`.depcon`(非破壊メソッド)と`.depcon!`(破壊メソッド)をStringクラスに追加します。
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'depcon'
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
foo = "㈱サンプルから℡がありました。「さきほど送った1㌻の項目№③ですが、20㍉ではなく20㌢が正しい数値になります。修正お願いします。」"
|
20
|
+
|
21
|
+
p foo.depcon # "(株)サンプルからTELがありました。「さきほど送った1ページの項目No.(3)ですが、20ミリではなく20センチが正しい数値になります。修正お願いします。」"
|
22
|
+
|
23
|
+
foo.depcon!
|
24
|
+
|
25
|
+
p foo # "(株)サンプルからTELがありました。「さきほど送った1ページの項目No.(3)ですが、20ミリではなく20センチが正しい数値になります。修正お願いします。」"
|
26
|
+
```
|
27
|
+
|
28
|
+
## Example
|
29
|
+
|
30
|
+
```yml
|
31
|
+
№: No.
|
32
|
+
℡: TEL
|
33
|
+
㊤: (上)
|
34
|
+
㈱: (株)
|
35
|
+
㍻: 平成
|
36
|
+
㎜: mm
|
37
|
+
㎏: kg
|
38
|
+
㍉: ミリ
|
39
|
+
㌢: センチ
|
40
|
+
①: (1)
|
41
|
+
⑳: (20)
|
42
|
+
Ⅰ: I
|
43
|
+
Ⅶ: VII
|
44
|
+
Ⅹ: X
|
45
|
+
```
|
46
|
+
|
47
|
+
more [lib/dictionary.yml](https://github.com/t4traw/depcon/blob/master/lib/dictionary.yml)
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/t4traw/depcon.
|
data/Rakefile
ADDED
data/depcon.gemspec
ADDED
@@ -0,0 +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 'depcon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "depcon"
|
8
|
+
spec.version = Depcon::VERSION
|
9
|
+
spec.authors = ["t4traw"]
|
10
|
+
spec.email = ["t4traw@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Winで使われている代表的な機種依存文字を変換するgem}
|
13
|
+
spec.description = %q{Winで使われている代表的な機種依存文字を変換するgem}
|
14
|
+
spec.homepage = "https://github.com/t4traw/depcon"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
26
|
+
spec.add_development_dependency "minitest-reporters"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
end
|
data/lib/depcon.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "depcon/version"
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class String
|
6
|
+
|
7
|
+
def depcon
|
8
|
+
d = self.dup
|
9
|
+
convert_dependent_char(d)
|
10
|
+
end
|
11
|
+
|
12
|
+
def depcon!
|
13
|
+
convert_dependent_char(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def convert_dependent_char(str)
|
19
|
+
dic = YAML.load_file("#{File.dirname(__FILE__)}/dictionary.yml")
|
20
|
+
dic.each do |key, val|
|
21
|
+
str.gsub!(/#{key}/, val)
|
22
|
+
end
|
23
|
+
str
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/dictionary.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
№: No.
|
2
|
+
㏍: K.K.
|
3
|
+
℡: TEL
|
4
|
+
㊤: (上)
|
5
|
+
㊥: (中)
|
6
|
+
㊦: (下)
|
7
|
+
㊧: (左)
|
8
|
+
㊨: (右)
|
9
|
+
㈱: (株)
|
10
|
+
㈲: (有)
|
11
|
+
㈹: (代)
|
12
|
+
㍾: 明治
|
13
|
+
㍽: 大正
|
14
|
+
㍼: 昭和
|
15
|
+
㍻: 平成
|
16
|
+
㎜: mm
|
17
|
+
㎝: cm
|
18
|
+
㎞: km
|
19
|
+
㎎: mg
|
20
|
+
㎏: kg
|
21
|
+
㏄: cc
|
22
|
+
㍉: ミリ
|
23
|
+
㌔: キロ
|
24
|
+
㌢: センチ
|
25
|
+
㍍: メートル
|
26
|
+
㌘: グラム
|
27
|
+
㌧: トン
|
28
|
+
㌃: アール
|
29
|
+
㌶: ヘクタール
|
30
|
+
㍑: リットル
|
31
|
+
㍗: ワット
|
32
|
+
㌍: カロリー
|
33
|
+
㌦: ドル
|
34
|
+
㌣: セント
|
35
|
+
㌫: パーセント
|
36
|
+
㍊: ミリバール
|
37
|
+
㌻: ページ
|
38
|
+
①: (1)
|
39
|
+
②: (2)
|
40
|
+
③: (3)
|
41
|
+
④: (4)
|
42
|
+
⑤: (5)
|
43
|
+
⑥: (6)
|
44
|
+
⑦: (7)
|
45
|
+
⑧: (8)
|
46
|
+
⑨: (9)
|
47
|
+
⑩: (10)
|
48
|
+
⑪: (11)
|
49
|
+
⑫: (12)
|
50
|
+
⑬: (13)
|
51
|
+
⑭: (14)
|
52
|
+
⑮: (15)
|
53
|
+
⑯: (16)
|
54
|
+
⑰: (17)
|
55
|
+
⑱: (18)
|
56
|
+
⑲: (19)
|
57
|
+
⑳: (20)
|
58
|
+
Ⅰ: I
|
59
|
+
Ⅱ: II
|
60
|
+
Ⅲ: III
|
61
|
+
Ⅳ: IV
|
62
|
+
Ⅴ: V
|
63
|
+
Ⅵ: VI
|
64
|
+
Ⅶ: VII
|
65
|
+
Ⅷ: VIII
|
66
|
+
Ⅸ: IX
|
67
|
+
Ⅹ: X
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: depcon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- t4traw
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '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'
|
83
|
+
description: Winで使われている代表的な機種依存文字を変換するgem
|
84
|
+
email:
|
85
|
+
- t4traw@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/console
|
96
|
+
- bin/setup
|
97
|
+
- depcon.gemspec
|
98
|
+
- lib/depcon.rb
|
99
|
+
- lib/depcon/version.rb
|
100
|
+
- lib/dictionary.yml
|
101
|
+
homepage: https://github.com/t4traw/depcon
|
102
|
+
licenses: []
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.5.2
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Winで使われている代表的な機種依存文字を変換するgem
|
124
|
+
test_files: []
|