ruby-short_url 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/lib/ruby/short_url/encoder.rb +3 -3
- data/lib/ruby/short_url/version.rb +1 -1
- data/lib/ruby-short_url.rb +2 -2
- data/ruby-short_url.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 192c6995b9316fbaca400d15b827721689404d83
|
4
|
+
data.tar.gz: 78041a4f6e844b9de877be4b180f8a7ee2075f07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463ac634e1cb35ce867323720933b810690d87c9719423cd76c50bfd6cd9d9448cacf5e098e63ac26d622aa8403576ba436064f06b8ace3c06728db23b881899
|
7
|
+
data.tar.gz: f98d70f0346e34dfce2d1348dec11783194711807a10928a29fd7899b198d4fdb5144a73ebe87d36e6e387401745e61283c18658cbf698d19d55e62588d5540f
|
data/.travis.yml
CHANGED
@@ -7,8 +7,8 @@ module Ruby
|
|
7
7
|
MIN_LENGTH = 5
|
8
8
|
|
9
9
|
def initialize(alphabet: DEFAULT_ALPHABET, block_size: DEFAULT_BLOCK_SIZE)
|
10
|
-
raise ArgumentError.new
|
11
|
-
raise ArgumentError.new
|
10
|
+
raise ArgumentError.new('alphabet must contain at least 2 characters.') if alphabet.length < 2
|
11
|
+
raise ArgumentError.new('block_size must be greater than 0.') unless block_size > 0
|
12
12
|
|
13
13
|
@alphabet = alphabet
|
14
14
|
@block_size = block_size
|
@@ -45,7 +45,7 @@ module Ruby
|
|
45
45
|
def debase(x)
|
46
46
|
n = @alphabet.length
|
47
47
|
x.split('').reverse.each_with_index.inject(0) do |result, (c, i)|
|
48
|
-
result + @alphabet.index(c) * (n
|
48
|
+
result + @alphabet.index(c) * (n**i)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
data/lib/ruby-short_url.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'ruby/short_url/version'
|
2
|
+
require 'ruby/short_url/encoder'
|
data/ruby-short_url.gemspec
CHANGED
@@ -5,10 +5,10 @@ require 'ruby/short_url/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "ruby-short_url"
|
7
7
|
spec.version = Ruby::ShortUrl::VERSION
|
8
|
-
spec.authors = ["
|
8
|
+
spec.authors = ["toshimaru"]
|
9
9
|
spec.email = ["me@toshimaru.net"]
|
10
10
|
|
11
|
-
spec.summary = %q{
|
11
|
+
spec.summary = %q{Small library for generating tiny URL. Ruby port of python-short_url.}
|
12
12
|
spec.homepage = "https://github.com/toshimaru/ruby-short_url"
|
13
13
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-short_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- toshimaru
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.6.11
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
|
-
summary:
|
138
|
+
summary: Small library for generating tiny URL. Ruby port of python-short_url.
|
139
139
|
test_files: []
|