sjis_replacer 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da454b51ba2cdc371dee30812262c8d33ffa43b2
4
+ data.tar.gz: 3c196baf691ba1c140af2329d5c15ebebf38f0f9
5
+ SHA512:
6
+ metadata.gz: 5d5ec8b18df91df6438af4312fbc1b626456bbf370b06cdf32a33e8884e80bccbb98a7dd01e5365a447e31f3f0c83e0dd89e8ff6c653afd341ee126054bd05db
7
+ data.tar.gz: 6b1ee472aa6919ccdc7d4892012ff8efbed332a00430fa7be9d1318cc4c523c925e1113a274e1f7f0af541de3ccf4e364b2db11ab75cd07f7c2f80ca6ece608f
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
5
+ script: bundle exec rake test
6
+ notifications:
7
+ slack:
8
+ rooms:
9
+ secure: rYtA4FBXqKHYv+v7xA6FfkcsDXRexWyMj9WMG2YK7bgZoNG2N7q461Dr/lCU0JTuRGsxDIs5jHK+QFFZNW/h+SbhQfiew++W8FgoIbP/z7HuEW50SXLcigGb02YmQm+ybbh5Dw1QGmcTOVItXJfuFmrDm1fq0qO0HC0543Yn4BzrSdWnEWQSaK7JMBRc9aYVPc0VlWG8pGRLtW0PDb6D32MvEI4jPrnh2NPDomPT9YutmMC+jNBPKr72m68g3v2GogbX4irZ6Kp5UUUZtaDbt9yLRfNL/3bsVGVrS1S2qCO4If5xTtE7lvV807a8QuQIj4Y9YqRO7K+/wUrz4Yb2ycF7agAkjN+w2WNEjgsKeFk50R4BWKpSy6y2N2RIl7rdHVEnU1T9I6LH0do5hMGqhgDYgppb2F7YFL9buUqag6gKAX3BHIV16ADJOFBT2Hh2m6x9f5TRb5ZR4LDJBQaflMhj0pwmIcC5Bhr3yi45r/4xiJ1IQaspXCzvfUMXARgWqqSxxveVQ07obiFeFCZ2YJEyv9fYLxT39+9koP48iKHTzbtFi4ay37PfMaztiXM0dqTwdjbJ95krc8AoNuTDphgwLLW2Zxxz2+tFQiLcj1tebUZa1hBsil1EVI7P/8PjAjGowckCnEAnFBZS5oFrgE2qzuwIGbLRYeeoRev0tks=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sjis_replacer.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # SJISReplacer
2
+ [![Build Status](https://travis-ci.org/kurotaky/sjis_replacer.svg?branch=master)](https://travis-ci.org/kurotaky/sjis_replacer)
3
+
4
+ replace utf-8 characters to sjis safe.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'sjis_replacer'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install sjis_replacer
21
+
22
+ ## Usage
23
+
24
+ ```ruby
25
+ irb(main):010:0> SJISReplacer.replace('①')
26
+ #=> "1"
27
+
28
+ irb(main):020:0> SJISReplacer.replace('Ⅲ')
29
+ #=> "III"
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kurotaky/sjis_replacer.
41
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ Rake::TestTask.new do |t|
4
+ # To run test for only one file (or file path pattern)
5
+ # $ bundle exec rake test TEST=test/test_specified_path.rb
6
+ t.libs.concat ["test"]
7
+ t.test_files = Dir["test/**/test_*.rb"]
8
+ t.verbose = true
9
+ t.ruby_opts = ["-r config"]
10
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sjis_replacer"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module SJISReplacer
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,75 @@
1
+ require "sjis_replacer/version"
2
+
3
+ module SJISReplacer
4
+ def self.replace(characters)
5
+ non_sjis_safe_characters_list.each do |k, v|
6
+ characters.gsub!(k, v)
7
+ end
8
+ characters
9
+ end
10
+
11
+ def self.non_sjis_safe_characters_list
12
+ {
13
+ '①' => '1',
14
+ '②' => '2',
15
+ '③' => '3',
16
+ '④' => '4',
17
+ '⑤' => '5',
18
+ '⑥' => '6',
19
+ '⑦' => '7',
20
+ '⑧' => '8',
21
+ '⑨' => '9',
22
+ '⑩' => '10',
23
+ '⑪' => '11',
24
+ '⑫' => '12',
25
+ '⑬' => '13',
26
+ '⑭' => '14',
27
+ '⑮' => '15',
28
+ '⑯' => '16',
29
+ '⑰' => '17',
30
+ '⑱' => '18',
31
+ '⑲' => '19',
32
+ '⑳' => '20',
33
+ 'ⅰ' => 'i',
34
+ 'ⅱ' => 'ii',
35
+ 'ⅲ' => 'iii',
36
+ 'ⅳ' => 'iv',
37
+ 'ⅴ' => 'v',
38
+ 'ⅵ' => 'vi',
39
+ 'ⅶ' => 'vii',
40
+ 'ⅷ' => 'viii',
41
+ 'ⅸ' => 'ix',
42
+ 'ⅹ' => 'x',
43
+ 'Ⅰ' => 'I',
44
+ 'Ⅱ' => 'II',
45
+ 'Ⅲ' => 'III',
46
+ 'Ⅳ' => 'IV',
47
+ 'Ⅴ' => 'V',
48
+ 'Ⅵ' => 'VI',
49
+ 'Ⅶ' => 'VII',
50
+ 'Ⅷ' => 'VIII',
51
+ 'Ⅸ' => 'IX',
52
+ 'Ⅹ' => 'X',
53
+ '㏍' => 'K.K.',
54
+ '℡' => 'TEL',
55
+ '№' => 'No.',
56
+ '㈱' => '(株)',
57
+ '㈲' => '(有)',
58
+ '㈹' => '(代)',
59
+ '㊤' => '(上)',
60
+ '㊥' => '(中)',
61
+ '㊦' => '(下)',
62
+ '㊧' => '(左)',
63
+ '㊨' => '(右)',
64
+ '㍻' => '平成',
65
+ '㍼' => '昭和',
66
+ '㍽' => '大正',
67
+ '㍾' => '明治',
68
+ '⒈' => '1.',
69
+ '⒉' => '2.',
70
+ '⒊' => '3.',
71
+ '⒋' => '4.',
72
+ '⒌' => '5.'
73
+ }
74
+ end
75
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sjis_replacer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sjis_replacer"
8
+ spec.version = SJISReplacer::VERSION
9
+ spec.authors = ["Yuta Kurotaki"]
10
+ spec.email = ["yuta.kurotaki@gmail.com"]
11
+
12
+ spec.summary = %q{replace utf-8 characters to sjis safe.}
13
+ spec.description = %q{replace utf-8 characters to sjis safe.}
14
+ spec.homepage = "https://github.com/kurotaky/sjis_replacer"
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.10"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "test-unit"
23
+ spec.add_development_dependency "power_assert"
24
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sjis_replacer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Yuta Kurotaki
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-29 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: power_assert
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
+ description: replace utf-8 characters to sjis safe.
70
+ email:
71
+ - yuta.kurotaki@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - lib/sjis_replacer.rb
85
+ - lib/sjis_replacer/version.rb
86
+ - sjis_replacer.gemspec
87
+ homepage: https://github.com/kurotaky/sjis_replacer
88
+ licenses: []
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.4.8
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: replace utf-8 characters to sjis safe.
110
+ test_files: []