symbol_lookup 1.0.4
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 +7 -0
- data/ext/symbol_lookup/SymbolLookup.c +26 -0
- data/ext/symbol_lookup/extconf.rb +5 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b2b8007e0677cfc3161f00067e0f1d5a4c479189
|
4
|
+
data.tar.gz: 20dee3aa3694015bd25b573eb0d7f809d9a5e5e3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f77ffce96011270d313eeceb24278d485de55fbce181d384c77f0cd59c61b0059155c261138c58aeba461409c8958dd7402c637b9710338e1d06e7eb7bf80340
|
7
|
+
data.tar.gz: 69dedc4d7f09a056c0435538625ac88201bbf24c3e40ed4fff31853a04ff4c5db7ce7cfb1d6624334a011418eb10ec5cbe8058de4934046ec7330937d719fbe3
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#include "ruby.h"
|
2
|
+
|
3
|
+
/*
|
4
|
+
* call-seq:
|
5
|
+
* Symbol[str] => Symbol or nil
|
6
|
+
*
|
7
|
+
* Returns an extant symbol, which is the .to_sym of +str+, or
|
8
|
+
* nil if no such symbol exists.
|
9
|
+
*
|
10
|
+
* Symbol['Object'] #=> :Object
|
11
|
+
* Symbol['none such'] #=> nil
|
12
|
+
*/
|
13
|
+
|
14
|
+
VALUE
|
15
|
+
sym_lookup(VALUE cls, VALUE str)
|
16
|
+
{
|
17
|
+
st_data_t id;
|
18
|
+
if (id = rb_check_id(&str)) {
|
19
|
+
return ID2SYM(id);
|
20
|
+
}
|
21
|
+
return Qnil;
|
22
|
+
}
|
23
|
+
|
24
|
+
void Init_symbol_lookup() {
|
25
|
+
rb_define_singleton_method(rb_cSymbol, "[]", sym_lookup, 1);
|
26
|
+
}
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: symbol_lookup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew Kerwin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gemified version of the Symbol[str] method proposed in https://bugs.ruby-lang.org/issues/7854
|
14
|
+
email: matthew@kerwin.net.au
|
15
|
+
executables: []
|
16
|
+
extensions:
|
17
|
+
- ext/symbol_lookup/extconf.rb
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ext/symbol_lookup/SymbolLookup.c
|
21
|
+
- ext/symbol_lookup/extconf.rb
|
22
|
+
homepage: http://rubygems.org/gems/symbol_lookup
|
23
|
+
licenses:
|
24
|
+
- Simplified BSD License
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options:
|
28
|
+
- --title
|
29
|
+
- Symbol[]
|
30
|
+
- --main
|
31
|
+
- Symbol
|
32
|
+
- --line-numbers
|
33
|
+
- --tab-width
|
34
|
+
- '2'
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.0.0
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.0.2
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Symbol[str]
|
53
|
+
test_files: []
|