safe_intern 1.0.1 → 1.1.0
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/.gitignore +7 -0
- data/.travis.yml +1 -0
- data/Gemfile +1 -6
- data/Rakefile +1 -1
- data/ext/symbol_defined/extconf.rb +2 -0
- data/ext/symbol_defined/symbol_defined.c +42 -0
- data/safe_intern.gemspec +6 -3
- metadata +64 -28
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee18090fdd063ac1c39176b72b319fb5afb83b0
|
4
|
+
data.tar.gz: 56868cfedd38626f90c81c3fe8a8956b62d343a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6da40ab4b1ee204193716b29277b00660400462761a2c70979387f0f651cee7e98714aaedc754b52980b3d8d0ff5df6f592d3378175e3846da119bb852493cf
|
7
|
+
data.tar.gz: f38721903a27577dc326ad868c01624d715e99b669b65bde829f30203e301ca5fc74c6ccbe11f74cff94bb59a884291bc734247127fe66f696bc998e14e9a516
|
data/.gitignore
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
#include "ruby.h"
|
9
9
|
|
10
|
+
#ifdef RUBY2
|
11
|
+
|
10
12
|
VALUE
|
11
13
|
symbol_defined(VALUE self, VALUE str)
|
12
14
|
{
|
@@ -17,10 +19,50 @@ symbol_defined(VALUE self, VALUE str)
|
|
17
19
|
}
|
18
20
|
}
|
19
21
|
|
22
|
+
#else
|
23
|
+
|
24
|
+
st_table *cached_symbols;
|
25
|
+
|
26
|
+
VALUE
|
27
|
+
symbol_defined(VALUE self, VALUE str)
|
28
|
+
{
|
29
|
+
int i;
|
30
|
+
VALUE string;
|
31
|
+
st_data_t data;
|
32
|
+
|
33
|
+
ID to_s;
|
34
|
+
VALUE symbols;
|
35
|
+
|
36
|
+
to_s = rb_intern("to_s");
|
37
|
+
// extremely slow, but necessary to see when new symbol has been added
|
38
|
+
symbols = rb_sym_all_symbols();
|
39
|
+
|
40
|
+
if(cached_symbols == NULL || cached_symbols->num_entries != RARRAY_LEN(symbols)){
|
41
|
+
cached_symbols = st_init_strtable_with_size(2000);
|
42
|
+
for (i = 0; i < RARRAY_LEN(symbols); i++)
|
43
|
+
{
|
44
|
+
string = rb_funcall(rb_ary_entry(symbols, i), to_s, 0, NULL);
|
45
|
+
st_add_direct(cached_symbols, (st_data_t)StringValueCStr(string), NULL);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
if (st_lookup(cached_symbols, StringValueCStr(str), &data)) {
|
50
|
+
return Qtrue;
|
51
|
+
} else {
|
52
|
+
return Qfalse;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
#endif
|
57
|
+
|
20
58
|
VALUE cSafeIntern;
|
21
59
|
|
22
60
|
void Init_symbol_defined()
|
23
61
|
{
|
24
62
|
cSafeIntern = rb_define_module("SafeIntern");
|
25
63
|
rb_define_module_function(cSafeIntern, "symbol_defined?", symbol_defined, 1);
|
64
|
+
|
65
|
+
#ifndef RUBY2
|
66
|
+
st_init_table_with_size(&cached_symbols, 1000);
|
67
|
+
#endif
|
26
68
|
}
|
data/safe_intern.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'safe_intern'
|
3
|
-
gem.version = '1.0
|
3
|
+
gem.version = '1.1.0'
|
4
4
|
gem.date = '2014-03-25'
|
5
5
|
gem.summary = 'Safe String#intern'
|
6
6
|
gem.description = 'Safe implementation of String#intern'
|
@@ -8,9 +8,12 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.email = 'rusnackoj@gmail.com'
|
9
9
|
gem.files = `git ls-files`.split($/)
|
10
10
|
gem.extensions = 'ext/symbol_defined/extconf.rb'
|
11
|
-
gem.required_ruby_version = ['>=
|
11
|
+
gem.required_ruby_version = ['>= 1.9.3']
|
12
12
|
gem.homepage = 'https://github.com/jrusnack/safe_intern'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
gem.cert_chain = ['certs/gem-jrusnack.pem']
|
15
|
-
gem.
|
15
|
+
gem.add_development_dependency 'rake'
|
16
|
+
gem.add_development_dependency 'rake-compiler'
|
17
|
+
gem.add_development_dependency 'rspec'
|
18
|
+
gem.add_development_dependency 'rubocop'
|
16
19
|
end
|
metadata
CHANGED
@@ -1,37 +1,72 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_intern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Rusnacko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlydXNu
|
14
|
-
YWNrb2oxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
15
|
-
bTAeFw0xNDAzMjUwOTQ5NTdaFw0xNTAzMjUwOTQ5NTdaMEAxEjAQBgNVBAMMCXJ1
|
16
|
-
c25hY2tvajEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
17
|
-
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1QvHuxVQGtZqsW5Z
|
18
|
-
tpRDT/0xME1j2QdUq3JrlJCAaRReSnPFSc/nXH/qKgQU8meNnsM/Ob3U3GlfAMqO
|
19
|
-
0QPZ9qRRhNWVCybHvaF0lhOtOOkhqYwLlrFvenL5f8WNDcwkrSdtkWrixXxzj+i/
|
20
|
-
BjDOCgAV5+KwwyRPSjIMBLK30z1BOwG3N10xsUGF2itFvi8NKSjphs3VCkrajanr
|
21
|
-
hGl8uKxotqKeiYRE4mP3J+r0rrr/d3iCypEkouxFlvU0Xau+PcL53/2PS3XbhdEk
|
22
|
-
6zu5Hp9iT0cKTV7OavmE7DZWk8O31qv8KZxLUkWKlAXfs7TslXsi3Q++DXwk0aHb
|
23
|
-
qihCnwIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
24
|
-
N05VfWnVrbsMy7dMK/62vjLKML8wHgYDVR0RBBcwFYETcnVzbmFja29qQGdtYWls
|
25
|
-
LmNvbTAeBgNVHRIEFzAVgRNydXNuYWNrb2pAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
26
|
-
BQUAA4IBAQDHgjOj4/w/f9yWeZRSEzIKJsnoCRS5KRcv/Vz1oYJm9AcelBni0GmV
|
27
|
-
Iq+UbdH+FEm98RIiLu2EAZ2jg2aGX3Uy2xee4KFmRbGaqWDavu+d+d4JEa8BAl9h
|
28
|
-
TukEOyv1yUgX8HyBlJNT0uhnL1Gv7Sk464tqhf4AYozPAuVu2n9pDiLtIMiYYcGK
|
29
|
-
Y9pJY761LDuFfHvmfc5m0gW62w948VuKYqVcdB6+VB0TGx4OFt8pI/4vduWFRWp7
|
30
|
-
ydN7L4RPVeCtwP4tzLMPLmzB2c84vC+0PS3gnEGcxWR524MVQAWMJinYIX7ZeLju
|
31
|
-
P7zsEz7FMVB2vF/xiGSwMfk4JV+/FDS5
|
32
|
-
-----END CERTIFICATE-----
|
11
|
+
- certs/gem-jrusnack.pem
|
33
12
|
date: 2014-03-25 00:00:00.000000000 Z
|
34
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake-compiler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubocop
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
35
70
|
description: Safe implementation of String#intern
|
36
71
|
email: rusnackoj@gmail.com
|
37
72
|
executables: []
|
@@ -39,7 +74,8 @@ extensions:
|
|
39
74
|
- ext/symbol_defined/extconf.rb
|
40
75
|
extra_rdoc_files: []
|
41
76
|
files:
|
42
|
-
- .
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
43
79
|
- Gemfile
|
44
80
|
- History.md
|
45
81
|
- LICENSE
|
@@ -68,12 +104,12 @@ require_paths:
|
|
68
104
|
- lib
|
69
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
106
|
requirements:
|
71
|
-
- -
|
107
|
+
- - ">="
|
72
108
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
109
|
+
version: 1.9.3
|
74
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
111
|
requirements:
|
76
|
-
- -
|
112
|
+
- - ">="
|
77
113
|
- !ruby/object:Gem::Version
|
78
114
|
version: '0'
|
79
115
|
requirements: []
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED