baser 0.1.0 → 0.1.2
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 +4 -4
- data/lib/baser/version.rb +1 -1
- data/lib/baser.rb +7 -1
- data/lib/generators/baser/install_generator.rb +1 -1
- data/lib/generators/templates/baser.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21ff9e571151b2896e8ffb2a53bf6100477c95d7b043539dae67360ca2e6517c
|
4
|
+
data.tar.gz: 5c0b3dc4acaf4a1bbd43770a0176430dc507b56b0f90cbe9a61cba8654d0d68b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2d1a56dccda83fbbbc1563b478b4bc880d59e3ad6c1dc493bb2167b87b683bad6bc154a19556a9095b2f9bc27983f25864bbc2553bd9d97d9f6d07feae486e
|
7
|
+
data.tar.gz: f408760d9309cb4b2c37cea9a4076eb176a4bbd6f630d6fbafd74b9949af897bfa7cdef58083a5344dc56aad39265634a5b0cb22a0112bc12bfae1123b6b23f5
|
data/lib/baser/version.rb
CHANGED
data/lib/baser.rb
CHANGED
@@ -17,6 +17,8 @@ module Baser
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def characters
|
20
|
+
raise Error, "set of characters should be greater than 10 characters" if @characters && @characters.length <= 10
|
21
|
+
|
20
22
|
@characters ||= DEFAULT_CHARACTERS
|
21
23
|
end
|
22
24
|
|
@@ -55,7 +57,11 @@ module Baser
|
|
55
57
|
def validate?(string)
|
56
58
|
raise Error, "parameter is empty" if string == ""
|
57
59
|
raise Error, "not a string" unless string.is_a? String
|
58
|
-
|
60
|
+
|
61
|
+
unless character_checker(string)
|
62
|
+
raise Error,
|
63
|
+
"one or more characters are not included in the initial set of characters"
|
64
|
+
end
|
59
65
|
|
60
66
|
true
|
61
67
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Baser
|
4
4
|
# Execute generator to create file on initializer
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
|
-
source_root File.expand_path("templates", __dir__)
|
6
|
+
source_root File.expand_path("../templates", __dir__)
|
7
7
|
desc "This generator creates an baser.rb file at config/initializers"
|
8
8
|
def copy_initializer_file
|
9
9
|
copy_file "baser.rb", "config/initializers/baser.rb"
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
Baser.setup do |config|
|
4
4
|
# NOTE: Your sequence should be array form
|
5
|
+
# assign more than 10 characters for it to work
|
5
6
|
# This is the default characters without 0 0 I l as it is confusing
|
6
7
|
# config.charcaters = ("0".."9").to_a + ("a".."z").to_a + ("A".."Z").to_a - %w[0 O I l]
|
7
8
|
# config.characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".each_char.map { |c| c }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -54,5 +54,5 @@ requirements: []
|
|
54
54
|
rubygems_version: 3.4.21
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
|
-
summary: Simple and flexible way to convert base
|
57
|
+
summary: Simple and flexible way to convert base 10 to baseANY and vice versa
|
58
58
|
test_files: []
|