n_cipher 0.3.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55856584bfc84a9712668f10e66ffedc63298846
4
- data.tar.gz: 55913d58805b7e3663f85825e11694eb7d43bd5a
3
+ metadata.gz: 6cd9e5cbf7ec143b9aac22c1196d8b9be2ef545a
4
+ data.tar.gz: b3a5a4a267f19bbcad97dc265093fc09e6eda655
5
5
  SHA512:
6
- metadata.gz: 5582c0208aa3a7a719b1fec115026b40ad9c8dd6b28bae2a924c95b05976f5252fe4ca584515bdae216d3c98852ae83bb591ca619dd725a24a4acdf708153962
7
- data.tar.gz: da9170abf6fbfa984976fcac3c733483a7f3e61fe7e2a0be955a69413bca97c8f1ec2d917506a07ce37d24706219c43fbb234e3ba80fdb8a7b7763842d2ae089
6
+ metadata.gz: 0178ed07ced51ac08b25f24609a0df49974d2ae817ab19edf148d387d9b00281a930cb98a0f90ff16d6c77ad61a64351d62f838bf1e2a3d55f75a2139a13ba05
7
+ data.tar.gz: 2722748a052d5cc3c7c691ac17f27e7943b9cf5b0953aeb1aa1bae8b5388bf655625b480b375fd9daf046be29051e994e773e244f814b7a36405682cf8fbfcf4
data/.codeclimate.yml ADDED
@@ -0,0 +1,13 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+ ratings:
5
+ paths:
6
+ - exe/**
7
+ - lib/**
8
+ - "**.rb"
9
+ exclude_paths:
10
+ - "README.md"
11
+ - "LICENSE.txt"
12
+ - test/**/*
13
+ - bin/**/*
data/README.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # NCipher
2
2
 
3
3
  [![Gem](https://img.shields.io/gem/v/n_cipher.svg)](https://rubygems.org/gems/n_cipher)
4
+ [![Required Ruby](https://img.shields.io/badge/ruby-%3E%3D%202.1.0-red.svg)](#)
4
5
  [![Travis branch](https://img.shields.io/travis/844196/n_cipher.svg)](https://travis-ci.org/844196/n_cipher)
5
6
  [![Coveralls branch](https://img.shields.io/coveralls/844196/n_cipher/master.svg)](https://coveralls.io/github/844196/n_cipher)
6
7
  [![Code Climate](https://img.shields.io/codeclimate/github/844196/n_cipher.svg)](https://codeclimate.com/github/844196/n_cipher)
8
+ [![Issues](http://img.shields.io/github/issues/844196/n_cipher.svg)](https://github.com/844196/n_cipher/issues)
9
+ [![Documents](http://img.shields.io/badge/doc-そんな物はない-red.svg?style=social)](#)
10
+
11
+ ![](https://cloud.githubusercontent.com/assets/4990822/10408480/9bf5d63a-6f39-11e5-9568-55e24afcbdc5.png)
12
+
13
+ 文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です
7
14
 
8
15
  ## Installation
9
16
 
@@ -1,3 +1,3 @@
1
1
  module NCipher
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/n_cipher.rb CHANGED
@@ -16,11 +16,11 @@ module NCipher
16
16
  raise ArgumentError, 'Invalid argument.' if obj.empty?
17
17
  end
18
18
  raise ArgumentError, 'Seed must be 2 to 10 characters.' unless seed.size.between?(2, 10)
19
- raise ArgumentError, 'Seed and delimiter are duplicated.' unless (seed.chars.uniq.sort & delimiter.chars.uniq.sort).size.zero?
19
+ raise ArgumentError, 'Seed and delimiter are duplicated.' unless (seed.chars & delimiter.chars).size.zero?
20
20
  # シード値が重複していないか?
21
21
  # OK: 'あいう'
22
22
  # NG: 'ああい'(「あ」が重複)
23
- raise ArgumentError, 'Character is duplicated in seed.' unless seed.chars.size == seed.chars.uniq.size
23
+ raise ArgumentError, 'Character is duplicated in seed.' unless seed.size == seed.chars.uniq.size
24
24
  end
25
25
  end
26
26
 
@@ -35,7 +35,7 @@ module NCipher
35
35
 
36
36
  def decode(string, seed: , delimiter: )
37
37
  common_argument_check(string, seed, delimiter)
38
- raise ArgumentError, 'Delimiter is not include in the cipher string.' unless delimiter.chars.map {|char| string.include?(char) }.all?
38
+ raise ArgumentError, 'Delimiter is not include in the cipher string.' unless string.match(delimiter)
39
39
  raise ArgumentError, 'Invalid cipher string.' unless (string.chars - "#{seed}#{delimiter}".chars).size.zero?
40
40
 
41
41
  string.split(delimiter).map {|ele| [ele.gsub(/./, convert_table(seed, :decode)).to_i(seed.size)].pack('U') }.join
data/n_cipher.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.required_ruby_version = '>= 2.1.0'
22
23
  spec.add_development_dependency "bundler", "~> 1.9"
23
24
  spec.add_development_dependency "rake", "~> 10.0"
24
25
  spec.add_development_dependency "test-unit"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n_cipher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaya Takeda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-10 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: 文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です
83
+ description: "文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です"
84
84
  email:
85
85
  - 844196@gmail.com
86
86
  executables:
@@ -88,6 +88,7 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".codeclimate.yml"
91
92
  - ".gitignore"
92
93
  - ".travis.yml"
93
94
  - Gemfile
@@ -112,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
113
  requirements:
113
114
  - - ">="
114
115
  - !ruby/object:Gem::Version
115
- version: '0'
116
+ version: 2.1.0
116
117
  required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  requirements:
118
119
  - - ">="
@@ -123,5 +124,5 @@ rubyforge_project:
123
124
  rubygems_version: 2.4.5.1
124
125
  signing_key:
125
126
  specification_version: 4
126
- summary: ぱすすにすに〜ぱすすゃぱす〜ぱすすんんに〜ぱすすゃにゃ〜ぱすすににん〜ぱすぱんぱゃ
127
+ summary: "ぱすすにすに〜ぱすすゃぱす〜ぱすすんんに〜ぱすすゃにゃ〜ぱすすににん〜ぱすぱんぱゃ"
127
128
  test_files: []