namespace_helper 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/.yardopts +5 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +54 -0
- data/HISTORY.md +7 -0
- data/LICENSE.md +15 -0
- data/README.md +192 -0
- data/Rakefile +47 -0
- data/lib/aef/namespace_helper.rb +159 -0
- data/lib/namespace_helper/bare.rb +20 -0
- data/lib/namespace_helper.rb +24 -0
- data/namespace_helper.gemspec +57 -0
- data/spec/aef/namespace_helper_spec.rb +281 -0
- data/spec/spec_helper.rb +26 -0
- data.tar.gz.sig +4 -0
- metadata +187 -0
- metadata.gz.sig +0 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
source 'http://rubygems.org'
|
21
|
+
|
22
|
+
# Specify your gem's dependencies in namespace_helper.gemspec
|
23
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
namespace_helper (1.0.0rc1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.0.5)
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
maruku (0.6.0)
|
12
|
+
syntax (>= 1.0.0)
|
13
|
+
method_source (0.7.0)
|
14
|
+
multi_json (1.0.4)
|
15
|
+
pry (0.9.8.2)
|
16
|
+
coderay (~> 1.0.5)
|
17
|
+
method_source (~> 0.7)
|
18
|
+
slop (>= 2.4.4, < 3)
|
19
|
+
pry (0.9.8.2-java)
|
20
|
+
coderay (~> 1.0.5)
|
21
|
+
method_source (~> 0.7)
|
22
|
+
slop (>= 2.4.4, < 3)
|
23
|
+
spoon (~> 0.0)
|
24
|
+
rake (0.9.2.2)
|
25
|
+
rspec (2.6.0)
|
26
|
+
rspec-core (~> 2.6.0)
|
27
|
+
rspec-expectations (~> 2.6.0)
|
28
|
+
rspec-mocks (~> 2.6.0)
|
29
|
+
rspec-core (2.6.4)
|
30
|
+
rspec-expectations (2.6.0)
|
31
|
+
diff-lcs (~> 1.1.2)
|
32
|
+
rspec-mocks (2.6.0)
|
33
|
+
simplecov (0.5.4)
|
34
|
+
multi_json (~> 1.0.3)
|
35
|
+
simplecov-html (~> 0.5.3)
|
36
|
+
simplecov-html (0.5.3)
|
37
|
+
slop (2.4.4)
|
38
|
+
spoon (0.0.1)
|
39
|
+
syntax (1.0.0)
|
40
|
+
yard (0.7.5)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
java
|
44
|
+
ruby
|
45
|
+
|
46
|
+
DEPENDENCIES
|
47
|
+
bundler (~> 1.0.21)
|
48
|
+
maruku (~> 0.6.0)
|
49
|
+
namespace_helper!
|
50
|
+
pry (~> 0.9.8)
|
51
|
+
rake (~> 0.9.2)
|
52
|
+
rspec (~> 2.6.0)
|
53
|
+
simplecov (~> 0.5.4)
|
54
|
+
yard (~> 0.7.5)
|
data/HISTORY.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
2
|
+
|
3
|
+
NamespaceHelper is licensed under the following ISC-style license:
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
11
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
NamespaceHelper
|
2
|
+
===============
|
3
|
+
|
4
|
+
[![Build Status](https://secure.travis-ci.org/aef/namespace_helper.png)](
|
5
|
+
https://secure.travis-ci.org/aef/namespace_helper)
|
6
|
+
|
7
|
+
* [Documentation][1]
|
8
|
+
* [Project][2]
|
9
|
+
|
10
|
+
[1]: http://rdoc.info/projects/aef/namespace_helper/
|
11
|
+
[2]: http://github.com/aef/namespace_helper/
|
12
|
+
|
13
|
+
Description
|
14
|
+
-----------
|
15
|
+
|
16
|
+
NamespaceHelper provides a module with methods to ease namespace handling.
|
17
|
+
For example getting the unprefixed name, the namespace parent or a list of
|
18
|
+
namespace components of a class or module.
|
19
|
+
|
20
|
+
Features / Problems
|
21
|
+
-------------------
|
22
|
+
|
23
|
+
This project tries to conform to:
|
24
|
+
|
25
|
+
* [Semantic Versioning (2.0.0-rc.1)][5]
|
26
|
+
* [Ruby Packaging Standard (0.5-draft)][6]
|
27
|
+
* [Ruby Style Guide][7]
|
28
|
+
* [Gem Packaging: Best Practices][8]
|
29
|
+
|
30
|
+
[5]: http://semver.org/
|
31
|
+
[6]: http://chneukirchen.github.com/rps/
|
32
|
+
[7]: https://github.com/bbatsov/ruby-style-guide
|
33
|
+
[8]: http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
|
34
|
+
|
35
|
+
Additional facts:
|
36
|
+
|
37
|
+
* Written purely in Ruby.
|
38
|
+
* Intended to be used with Ruby 1.9.2 or compatible.
|
39
|
+
* Extends core classes. This can be disabled through bare mode.
|
40
|
+
|
41
|
+
Synopsis
|
42
|
+
--------
|
43
|
+
|
44
|
+
This documentation defines the public interface of the library. Don't rely
|
45
|
+
on elements marked as private. Those should be hidden in the documentation
|
46
|
+
by default.
|
47
|
+
|
48
|
+
### Loading
|
49
|
+
|
50
|
+
In most cases you want to load the library by the following command:
|
51
|
+
|
52
|
+
~~~~~ ruby
|
53
|
+
require 'namespace_helper'
|
54
|
+
~~~~~
|
55
|
+
|
56
|
+
In a bundler Gemfile you should use the following:
|
57
|
+
|
58
|
+
~~~~~ ruby
|
59
|
+
gem 'namespace_helper'
|
60
|
+
~~~~~
|
61
|
+
|
62
|
+
By default, NamespaceHelper extends the Class and Module classes to allow make
|
63
|
+
all classes and modules support the namespace helper methods. Should you really don't want this, use the following:
|
64
|
+
|
65
|
+
~~~~~ ruby
|
66
|
+
require 'namespace_helper/bare'
|
67
|
+
~~~~~
|
68
|
+
|
69
|
+
Or for bundler Gemfiles:
|
70
|
+
|
71
|
+
~~~~~ ruby
|
72
|
+
gem 'namespace_helper', require: 'namespace_helper/bare'
|
73
|
+
~~~~~
|
74
|
+
|
75
|
+
### Usage
|
76
|
+
|
77
|
+
In normal mode, you can now ask every class or module namespace related
|
78
|
+
stuff:
|
79
|
+
|
80
|
+
~~~~~ ruby
|
81
|
+
Process::Status.namespace_components
|
82
|
+
# => [Process, Process::Status]
|
83
|
+
|
84
|
+
Process::Status.namespace_component_names
|
85
|
+
# => ["Process", "Process::Status"]
|
86
|
+
|
87
|
+
Process::Status.unprefixed_namespace_component_names
|
88
|
+
# => ["Process", "Status"]
|
89
|
+
~~~~~
|
90
|
+
|
91
|
+
See {Aef::NamespaceHelper::ClassMethods} for a list of available methods.
|
92
|
+
|
93
|
+
If you're using the bare mode, you have to manually extend a class or module
|
94
|
+
for which you require namespace information:
|
95
|
+
|
96
|
+
~~~~~ ruby
|
97
|
+
File::Constants.extend(Aef::NamespaceHelper::ClassMethods)
|
98
|
+
|
99
|
+
File::Constants.unprefixed_name
|
100
|
+
# => "Constants"
|
101
|
+
|
102
|
+
File::Constants.namespace_parent
|
103
|
+
# => File
|
104
|
+
|
105
|
+
File::Constants.namespace_parent_name
|
106
|
+
# => "File"
|
107
|
+
~~~~~
|
108
|
+
|
109
|
+
Requirements
|
110
|
+
------------
|
111
|
+
|
112
|
+
None
|
113
|
+
|
114
|
+
Installation
|
115
|
+
------------
|
116
|
+
|
117
|
+
On *nix systems you may need to prefix the command with sudo to get root
|
118
|
+
privileges.
|
119
|
+
|
120
|
+
### High security (recommended)
|
121
|
+
|
122
|
+
There is a high security installation option available through rubygems. It is
|
123
|
+
highly recommended over the normal installation, although it may be a bit less
|
124
|
+
comfortable. To use the installation method, you will need my public key, which
|
125
|
+
I use for cryptographic signatures on all my gems. You can find the public key
|
126
|
+
here: http://aef.name/crypto/aef-gem.pem
|
127
|
+
|
128
|
+
Add the key to your rubygems' trusted certificates by the following command:
|
129
|
+
|
130
|
+
gem cert --add aef-gem.pem
|
131
|
+
|
132
|
+
Now you can install the gem while automatically verifying it's signature by the
|
133
|
+
following command:
|
134
|
+
|
135
|
+
gem install namespace_helper -P HighSecurity
|
136
|
+
|
137
|
+
Please notice that you may need other keys for dependent libraries, so you may
|
138
|
+
have to install dependencies manually.
|
139
|
+
|
140
|
+
### Normal
|
141
|
+
|
142
|
+
gem install namespace_helper
|
143
|
+
|
144
|
+
### Automated testing
|
145
|
+
|
146
|
+
Go into the root directory of the installed gem and run the following command
|
147
|
+
to fetch all development dependencies:
|
148
|
+
|
149
|
+
bundle
|
150
|
+
|
151
|
+
Afterwards start the test runner:
|
152
|
+
|
153
|
+
rake spec
|
154
|
+
|
155
|
+
If something goes wrong you should be noticed through failing examples.
|
156
|
+
|
157
|
+
Development
|
158
|
+
-----------
|
159
|
+
|
160
|
+
This software is developed in the source code management system git hosted
|
161
|
+
at github.com. You can download the most recent sourcecode through the
|
162
|
+
following command:
|
163
|
+
|
164
|
+
git clone https://github.com/aef/namespace_helper.git
|
165
|
+
|
166
|
+
Help on making this software better is always very appreciated. If you want
|
167
|
+
your changes to be included in the official release, please clone my project
|
168
|
+
on github.com, create a named branch to commit and push your changes in and
|
169
|
+
send me a pull request afterwards.
|
170
|
+
|
171
|
+
Please make sure to write tests for your changes so that I won't break them
|
172
|
+
when changing other things on the library. Also notice that I can't promise
|
173
|
+
to include your changes before reviewing them.
|
174
|
+
|
175
|
+
License
|
176
|
+
-------
|
177
|
+
|
178
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
179
|
+
|
180
|
+
This file is part of NamespaceHelper.
|
181
|
+
|
182
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
183
|
+
purpose with or without fee is hereby granted, provided that the above
|
184
|
+
copyright notice and this permission notice appear in all copies.
|
185
|
+
|
186
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
187
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
188
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
189
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
190
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
191
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
192
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'rake'
|
21
|
+
require 'pathname'
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
require 'yard'
|
24
|
+
require 'rspec/core/rake_task'
|
25
|
+
|
26
|
+
RSpec::Core::RakeTask.new
|
27
|
+
|
28
|
+
YARD::Rake::YardocTask.new('doc')
|
29
|
+
|
30
|
+
desc "Removes temporary project files"
|
31
|
+
task :clean do
|
32
|
+
%w{doc coverage pkg .yardoc .rbx}.map{|name| Pathname.new(name) }.each do |path|
|
33
|
+
path.rmtree if path.exist?
|
34
|
+
end
|
35
|
+
|
36
|
+
Pathname.glob('*.gem').each &:delete
|
37
|
+
Pathname.glob('**/*.rbc').each &:delete
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Opens an interactive console with the library loaded"
|
41
|
+
task :console do
|
42
|
+
require 'pry'
|
43
|
+
require 'namespace_helper'
|
44
|
+
Pry.start
|
45
|
+
end
|
46
|
+
|
47
|
+
task :default => :spec
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
# Namespace for projects of Alexander E. Fischer <aef@raxys.net>.
|
21
|
+
#
|
22
|
+
# If you want to be able to simply type Example instead of Aef::Example to
|
23
|
+
# address classes in this namespace simply write the following before using the
|
24
|
+
# classes.
|
25
|
+
#
|
26
|
+
# @example Including the namespace
|
27
|
+
# include Aef
|
28
|
+
# @author Alexander E. Fischer
|
29
|
+
module Aef
|
30
|
+
|
31
|
+
# This module is intended to be included into the Class and/or Module class
|
32
|
+
# to make namespace helper methods available in all classes/modules.
|
33
|
+
#
|
34
|
+
# @see Aef::NamespaceHelper::ClassMethods
|
35
|
+
module NamespaceHelper
|
36
|
+
|
37
|
+
# The current library version
|
38
|
+
VERSION = '1.0.0'.freeze
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
# This magic method is automatically called when NamespaceHelper is
|
43
|
+
# included into a class/module to extend Aef::NamespaceHelper::ClassMethods
|
44
|
+
# into the same class/module.
|
45
|
+
def self.included(klass)
|
46
|
+
klass.extend(ClassMethods)
|
47
|
+
end
|
48
|
+
|
49
|
+
# This mixin module is intended to extend a single class/module object to
|
50
|
+
# make the helper methods only available on that specific class/module.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# First::Second.extend(Aef::NamespaceHelper::ClassMethods)
|
54
|
+
# First::Second.respond_to?(:unprefixed_name) # => true
|
55
|
+
# @see Aef::NamespaceHelper
|
56
|
+
module ClassMethods
|
57
|
+
|
58
|
+
# The name of the class/module itself, without any namespacing.
|
59
|
+
#
|
60
|
+
# @return [String] The unprefixed name of the class/module itself
|
61
|
+
# @since 1.0.0
|
62
|
+
# @example
|
63
|
+
# First::Second::Third.unprefixed_name # => "Third"
|
64
|
+
def unprefixed_name
|
65
|
+
unprefixed_namespace_component_names.last
|
66
|
+
end
|
67
|
+
|
68
|
+
# Lists all namespace components' unprefixed names.
|
69
|
+
#
|
70
|
+
# @return [Array<String>] All namespace components' unprefixed names.
|
71
|
+
# Ordered, so the class/module itself will be the last element
|
72
|
+
# @since 1.0.0
|
73
|
+
# @note This will not reference the class/module objects and thus won't
|
74
|
+
# trigger autoloading
|
75
|
+
# @example
|
76
|
+
# First::Second::Third.unprefixed_namespace_component_names
|
77
|
+
# # => ["First", "Second", "Third"]
|
78
|
+
def unprefixed_namespace_component_names
|
79
|
+
if self.name.nil? || self.name == ''
|
80
|
+
[]
|
81
|
+
else
|
82
|
+
self.name.split('::')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Lists all namespace components' names.
|
87
|
+
#
|
88
|
+
# @return [Array<String>] All namespace components' names. Ordered, so
|
89
|
+
# the class/module itself will be the last element
|
90
|
+
# @since 1.0.0
|
91
|
+
# @note This will not reference the class/module objects and thus won't
|
92
|
+
# trigger autoloading
|
93
|
+
# @example
|
94
|
+
# First::Second::Third.namespace_component_names
|
95
|
+
# # => ["First", "First::Second", "First::Second::Third"]
|
96
|
+
def namespace_component_names
|
97
|
+
if self.name.nil? || self.name == ''
|
98
|
+
[]
|
99
|
+
else
|
100
|
+
unprefixed_names = unprefixed_namespace_component_names
|
101
|
+
|
102
|
+
names = []
|
103
|
+
|
104
|
+
while current_name = unprefixed_names.pop
|
105
|
+
current_full_name = (unprefixed_names + [current_name]).join('::')
|
106
|
+
names.unshift(current_full_name)
|
107
|
+
end
|
108
|
+
|
109
|
+
names
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Lists all namespace components.
|
114
|
+
#
|
115
|
+
# @return [Array<Class, Module>] All namespace components. Ordered, so
|
116
|
+
# the class/module itself will be the last element.
|
117
|
+
# @since 1.0.0
|
118
|
+
# @example
|
119
|
+
# First::Second::Third.namespace_component_names
|
120
|
+
# # => [First, First::Second, First::Second::Third]
|
121
|
+
def namespace_components
|
122
|
+
components = []
|
123
|
+
|
124
|
+
unprefixed_names = unprefixed_namespace_component_names
|
125
|
+
current_component = Object
|
126
|
+
|
127
|
+
while current_name = unprefixed_names.shift
|
128
|
+
current_component = current_component.const_get(current_name)
|
129
|
+
components << current_component
|
130
|
+
end
|
131
|
+
|
132
|
+
components
|
133
|
+
end
|
134
|
+
|
135
|
+
# The name of component in the namespace which encapsulates this class/module.
|
136
|
+
#
|
137
|
+
# @return [String] The name of the parent namespace component
|
138
|
+
# @since 1.0.0
|
139
|
+
# @note This will not reference the class/module objects and thus won't trigger autoloading
|
140
|
+
# @example
|
141
|
+
# First::Second::Third.namespace_parent
|
142
|
+
# # => First::Second
|
143
|
+
def namespace_parent_name
|
144
|
+
namespace_component_names[-2]
|
145
|
+
end
|
146
|
+
|
147
|
+
# The component in the namespace which encapsulates this class/module.
|
148
|
+
#
|
149
|
+
# @return [Class, Module] The parent namespace component
|
150
|
+
# @since 1.0.0
|
151
|
+
# @example
|
152
|
+
# First::Second::Third.namespace_parent
|
153
|
+
# # => First::Second
|
154
|
+
def namespace_parent
|
155
|
+
namespace_components[-2]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'aef/namespace_helper'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'aef/namespace_helper'
|
21
|
+
|
22
|
+
[Class, Module].each do |object|
|
23
|
+
object.method(:include).call(Aef::NamespaceHelper::ClassMethods)
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
$LOAD_PATH << 'lib'
|
21
|
+
|
22
|
+
require 'namespace_helper/bare'
|
23
|
+
|
24
|
+
Gem::Specification.new do |s|
|
25
|
+
s.name = 'namespace_helper'
|
26
|
+
s.version = Aef::NamespaceHelper::VERSION.dup
|
27
|
+
s.authors = ['Alexander E. Fischer']
|
28
|
+
s.email = ['aef@raxys.net']
|
29
|
+
s.homepage = 'http://github.com/aef/namespace_helper'
|
30
|
+
s.license = 'ISC'
|
31
|
+
s.summary = 'Helper methods for class/module namespace handling'
|
32
|
+
s.description = <<-DESCRIPTION
|
33
|
+
NamespaceHelper provides a module with methods to ease namespace handling.
|
34
|
+
For example getting the unprefixed name, the namespace parent or a list of
|
35
|
+
namespace components of a class or module.
|
36
|
+
DESCRIPTION
|
37
|
+
|
38
|
+
s.rubyforge_project = nil
|
39
|
+
s.has_rdoc = 'yard'
|
40
|
+
s.extra_rdoc_files = ['HISTORY.md', 'LICENSE.md']
|
41
|
+
|
42
|
+
s.files = `git ls-files`.lines.map(&:chomp)
|
43
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.lines.map(&:chomp)
|
44
|
+
s.executables = `git ls-files -- bin/*`.lines.map{|f| File.basename(f.chomp) }
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
|
47
|
+
s.add_development_dependency('bundler', '~> 1.0.21')
|
48
|
+
s.add_development_dependency('rake', '~> 0.9.2')
|
49
|
+
s.add_development_dependency('rspec', '~> 2.6.0')
|
50
|
+
s.add_development_dependency('simplecov', '~> 0.5.4')
|
51
|
+
s.add_development_dependency('pry', '~> 0.9.8')
|
52
|
+
s.add_development_dependency('yard', '~> 0.7.5')
|
53
|
+
s.add_development_dependency('maruku', '~> 0.6.0')
|
54
|
+
|
55
|
+
s.cert_chain = "#{ENV['GEM_CERT_CHAIN']}".split(':')
|
56
|
+
s.signing_key = ENV['GEM_SIGNING_KEY']
|
57
|
+
end
|
@@ -0,0 +1,281 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
require 'namespace_helper/bare'
|
22
|
+
|
23
|
+
describe Aef::NamespaceHelper do
|
24
|
+
before(:all) do
|
25
|
+
samples = [
|
26
|
+
Class.new, Module.new,
|
27
|
+
Aef::NamespaceHelper::SomeClass = Class.new,
|
28
|
+
Aef::NamespaceHelper::SomeClass::SomeModule = Module.new,
|
29
|
+
Aef::NamespaceHelper::OtherModule = Module.new,
|
30
|
+
Aef::NamespaceHelper::OtherModule::OtherClass = Class.new,
|
31
|
+
AefNamespaceHelperParentlessClass = Class.new,
|
32
|
+
AefNamespaceHelperParentlessModule = Module.new
|
33
|
+
]
|
34
|
+
|
35
|
+
samples.each do |sample|
|
36
|
+
sample.extend(Aef::NamespaceHelper::ClassMethods)
|
37
|
+
end
|
38
|
+
|
39
|
+
@anonymous_class = samples[0]
|
40
|
+
@anonymous_module = samples[1]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "unprefixed name" do
|
44
|
+
it "should be nil for an anonymous class" do
|
45
|
+
@anonymous_class.unprefixed_name.should be_nil
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be nil for an anonymous module" do
|
49
|
+
@anonymous_module.unprefixed_name.should be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be SomeClass for Aef::NamespaceHelper::SomeClass" do
|
53
|
+
Aef::NamespaceHelper::SomeClass.
|
54
|
+
unprefixed_name.should == 'SomeClass'
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should be SomeModule for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
58
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.
|
59
|
+
unprefixed_name.should == 'SomeModule'
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should be OtherModule for Aef::NamespaceHelper::OtherModule" do
|
63
|
+
Aef::NamespaceHelper::OtherModule.
|
64
|
+
unprefixed_name.should == 'OtherModule'
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should be OtherClass for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
68
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.
|
69
|
+
unprefixed_name.should == 'OtherClass'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "unprefixed_namespace_component_names" do
|
74
|
+
it "should be an empty array for an anonymous class" do
|
75
|
+
@anonymous_class.unprefixed_namespace_component_names.should == []
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should be an emtpy array for an anonymous module" do
|
79
|
+
@anonymous_module.unprefixed_namespace_component_names.should == []
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should list all unprefixed namespace component names for Aef::NamespaceHelper::SomeClass" do
|
83
|
+
Aef::NamespaceHelper::SomeClass.unprefixed_namespace_component_names.should ==
|
84
|
+
['Aef', 'NamespaceHelper', 'SomeClass']
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should list all unprefixed namespace component names for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
88
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.unprefixed_namespace_component_names.should ==
|
89
|
+
['Aef', 'NamespaceHelper', 'SomeClass', 'SomeModule']
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should list all unprefixed namespace component names for Aef::NamespaceHelper::OtherModule" do
|
93
|
+
Aef::NamespaceHelper::OtherModule.unprefixed_namespace_component_names.should ==
|
94
|
+
['Aef', 'NamespaceHelper', 'OtherModule']
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should list all unprefixed namespace component names for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
98
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.unprefixed_namespace_component_names.should ==
|
99
|
+
['Aef', 'NamespaceHelper', 'OtherModule', 'OtherClass']
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "namespace_component_names" do
|
104
|
+
it "should be an empty array for an anonymous class" do
|
105
|
+
@anonymous_class.namespace_component_names.should == []
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should be an emtpy array for an anonymous module" do
|
109
|
+
@anonymous_module.namespace_component_names.should == []
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should list all namespace component names for Aef::NamespaceHelper::SomeClass" do
|
113
|
+
Aef::NamespaceHelper::SomeClass.namespace_component_names.should == [
|
114
|
+
'Aef',
|
115
|
+
'Aef::NamespaceHelper',
|
116
|
+
'Aef::NamespaceHelper::SomeClass'
|
117
|
+
]
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should list all namespace component names for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
121
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.namespace_component_names.should == [
|
122
|
+
'Aef',
|
123
|
+
'Aef::NamespaceHelper',
|
124
|
+
'Aef::NamespaceHelper::SomeClass',
|
125
|
+
'Aef::NamespaceHelper::SomeClass::SomeModule'
|
126
|
+
]
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should list all namespace component names for Aef::NamespaceHelper::OtherModule" do
|
130
|
+
Aef::NamespaceHelper::OtherModule.namespace_component_names.should == [
|
131
|
+
'Aef',
|
132
|
+
'Aef::NamespaceHelper',
|
133
|
+
'Aef::NamespaceHelper::OtherModule'
|
134
|
+
]
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should list all namespace component names for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
138
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.namespace_component_names.should == [
|
139
|
+
'Aef',
|
140
|
+
'Aef::NamespaceHelper',
|
141
|
+
'Aef::NamespaceHelper::OtherModule',
|
142
|
+
'Aef::NamespaceHelper::OtherModule::OtherClass',
|
143
|
+
]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "namespace_components" do
|
148
|
+
it "should be an empty array for an anonymous class" do
|
149
|
+
@anonymous_class.namespace_components.should == []
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should be an emtpy array for an anonymous module" do
|
153
|
+
@anonymous_module.namespace_components.should == []
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should list all namespace component names for Aef::NamespaceHelper::SomeClass" do
|
157
|
+
Aef::NamespaceHelper::SomeClass.namespace_components.should == [
|
158
|
+
Aef,
|
159
|
+
Aef::NamespaceHelper,
|
160
|
+
Aef::NamespaceHelper::SomeClass
|
161
|
+
]
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should list all namespace component names for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
165
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.namespace_components.should == [
|
166
|
+
Aef,
|
167
|
+
Aef::NamespaceHelper,
|
168
|
+
Aef::NamespaceHelper::SomeClass,
|
169
|
+
Aef::NamespaceHelper::SomeClass::SomeModule
|
170
|
+
]
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should list all namespace component names for Aef::NamespaceHelper::OtherModule" do
|
174
|
+
Aef::NamespaceHelper::OtherModule.namespace_components.should == [
|
175
|
+
Aef,
|
176
|
+
Aef::NamespaceHelper,
|
177
|
+
Aef::NamespaceHelper::OtherModule
|
178
|
+
]
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should list all namespace component names for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
182
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.namespace_components.should == [
|
183
|
+
Aef,
|
184
|
+
Aef::NamespaceHelper,
|
185
|
+
Aef::NamespaceHelper::OtherModule,
|
186
|
+
Aef::NamespaceHelper::OtherModule::OtherClass
|
187
|
+
]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe "namespace_parent_name" do
|
192
|
+
it "should be nil for an anonymous class" do
|
193
|
+
@anonymous_class.namespace_parent_name.should == nil
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should be nil for an anonymous module" do
|
197
|
+
@anonymous_module.namespace_parent_name.should == nil
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should be nil if a class has no namespace parent" do
|
201
|
+
AefNamespaceHelperParentlessClass.namespace_parent.should == nil
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should be nil if a module has no namespace parent" do
|
205
|
+
AefNamespaceHelperParentlessModule.namespace_parent.should == nil
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should be Aef::NamespaceHelper for Aef::NamespaceHelper::SomeClass" do
|
209
|
+
Aef::NamespaceHelper::SomeClass.
|
210
|
+
namespace_parent_name.should == 'Aef::NamespaceHelper'
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should be Aef::NamespaceHelper::SomeClass for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
214
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.
|
215
|
+
namespace_parent_name.should == 'Aef::NamespaceHelper::SomeClass'
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should be Aef::NamespaceHelper for Aef::NamespaceHelper::OtherModule" do
|
219
|
+
Aef::NamespaceHelper::OtherModule.
|
220
|
+
namespace_parent_name.should == 'Aef::NamespaceHelper'
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should be Aef::NamespaceHelper::OtherModule for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
224
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.
|
225
|
+
namespace_parent_name.should == 'Aef::NamespaceHelper::OtherModule'
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
describe "namespace_parent" do
|
230
|
+
it "should be nil for an anonymous class" do
|
231
|
+
@anonymous_class.namespace_parent.should == nil
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should be nil for an anonymous module" do
|
235
|
+
@anonymous_module.namespace_parent.should == nil
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should be nil if a class has no namespace parent" do
|
239
|
+
AefNamespaceHelperParentlessClass.namespace_parent.should == nil
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should be nil if a module has no namespace parent" do
|
243
|
+
AefNamespaceHelperParentlessModule.namespace_parent.should == nil
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should be Aef::NamespaceHelper for Aef::NamespaceHelper::SomeClass" do
|
247
|
+
Aef::NamespaceHelper::SomeClass.
|
248
|
+
namespace_parent.should == Aef::NamespaceHelper
|
249
|
+
end
|
250
|
+
|
251
|
+
it "should be Aef::NamespaceHelper::SomeClass for Aef::NamespaceHelper::SomeClass::SomeModule" do
|
252
|
+
Aef::NamespaceHelper::SomeClass::SomeModule.
|
253
|
+
namespace_parent.should == Aef::NamespaceHelper::SomeClass
|
254
|
+
end
|
255
|
+
|
256
|
+
it "should be Aef::NamespaceHelper for Aef::NamespaceHelper::OtherModule" do
|
257
|
+
Aef::NamespaceHelper::OtherModule.
|
258
|
+
namespace_parent.should == Aef::NamespaceHelper
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should be Aef::NamespaceHelper::OtherModule for Aef::NamespaceHelper::OtherModule::OtherClass" do
|
262
|
+
Aef::NamespaceHelper::OtherModule::OtherClass.
|
263
|
+
namespace_parent.should == Aef::NamespaceHelper::OtherModule
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
describe "core extension" do
|
268
|
+
it "should add the helper methods to all classes and modules" do
|
269
|
+
lambda {
|
270
|
+
require 'namespace_helper'
|
271
|
+
}.should change{
|
272
|
+
[ Integer.respond_to?(:unprefixed_namespace_component_names),
|
273
|
+
Float.respond_to?(:unprefixed_name),
|
274
|
+
Object.respond_to?(:namespace_component_names),
|
275
|
+
Regexp.respond_to?(:namespace_components),
|
276
|
+
File.respond_to?(:namespace_parent_name),
|
277
|
+
String.respond_to?(:namespace_parent) ].all?
|
278
|
+
}.from(false).to(true)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
|
4
|
+
|
5
|
+
This file is part of NamespaceHelper.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
18
|
+
=end
|
19
|
+
|
20
|
+
unless defined?(Rubinius)
|
21
|
+
require 'simplecov'
|
22
|
+
SimpleCov.start
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'rspec'
|
26
|
+
require 'pry'
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: namespace_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexander E. Fischer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- ! '-----BEGIN CERTIFICATE-----
|
13
|
+
|
14
|
+
MIIDKDCCAhCgAwIBAgIBADANBgkqhkiG9w0BAQUFADA6MQwwCgYDVQQDDANhZWYx
|
15
|
+
|
16
|
+
FTATBgoJkiaJk/IsZAEZFgVyYXh5czETMBEGCgmSJomT8ixkARkWA25ldDAeFw0w
|
17
|
+
|
18
|
+
OTAyMjUyMDM5MDhaFw0xMDAyMjUyMDM5MDhaMDoxDDAKBgNVBAMMA2FlZjEVMBMG
|
19
|
+
|
20
|
+
CgmSJomT8ixkARkWBXJheHlzMRMwEQYKCZImiZPyLGQBGRYDbmV0MIIBIjANBgkq
|
21
|
+
|
22
|
+
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoYtj0qad5/MpbdttITzBH0h1SNe6eO7R
|
23
|
+
|
24
|
+
7qVeqNYu6qDQAQ0rYc0JhubJCWYrZEJorHEBhUFU6cdQgQOs78wiJaDgkeU7YfXB
|
25
|
+
|
26
|
+
q2l125kJ8aHkA1ukrK2/DRzp2AHEmzxHIYpXV5/63h+NWjCP+uKvTELYsotS2MKt
|
27
|
+
|
28
|
+
3d43E0QajsPZu2ZuNFwkroqeue872gMHUldGOVy5WtSd9ajw2xI/CociY6746dL+
|
29
|
+
|
30
|
+
pYriV3QaYtR/ezeaLpKBLsc5T1UQ07t7Xs7mI281tdmRvpLdP5dQhjzInfio0CJv
|
31
|
+
|
32
|
+
1Pf5bZUjGG0K9RW2Gb/tGPSYEETiLMubjH61OwBooXKiWR5cs4/1BQIDAQABozkw
|
33
|
+
|
34
|
+
NzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUSYvjhG2EWnR5kx5l
|
35
|
+
|
36
|
+
DAewXCkJOVEwDQYJKoZIhvcNAQEFBQADggEBAB2ryDbU4bQtnunKv/AXq4CuO3LS
|
37
|
+
|
38
|
+
kik9Xhye8E/5dTcsgitCZJXAqx0rHcK0u2EHnjA5CDcdF5JB7XgSvRrQkFWoW/9K
|
39
|
+
|
40
|
+
lCB4ih+sB2AI2IUiYBeoCGctXdBQ020prqop/oTQEudzFk/gyQ686lp06HdLRt+O
|
41
|
+
|
42
|
+
HoQjTIab8vmfgIubjPdIRzokMfHbelvhLi+mQfWVghRhs2jpEfdXbL0w5nNw+trp
|
43
|
+
|
44
|
+
rO70Dw59hduDUOpgpxew+PLbs4vP1tb1QKPG+39C+PZtosbbf1fai0hqYV1txMCx
|
45
|
+
|
46
|
+
55akF+N8NbO6tpVDy6TMagqa10LfEpiQH6dvDHe/xdAqYOCrXKpmqzwu2PI=
|
47
|
+
|
48
|
+
-----END CERTIFICATE-----
|
49
|
+
|
50
|
+
'
|
51
|
+
date: 2012-02-24 00:00:00.000000000 Z
|
52
|
+
dependencies:
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: &10350060 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.0.21
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: *10350060
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rake
|
66
|
+
requirement: &10348240 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.9.2
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: *10348240
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: &10347220 !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.6.0
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: *10347220
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: simplecov
|
88
|
+
requirement: &10361840 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.5.4
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: *10361840
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: &10357220 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.9.8
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: *10357220
|
108
|
+
- !ruby/object:Gem::Dependency
|
109
|
+
name: yard
|
110
|
+
requirement: &10356380 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ~>
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.7.5
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: *10356380
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: maruku
|
121
|
+
requirement: &10370880 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ~>
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 0.6.0
|
127
|
+
type: :development
|
128
|
+
prerelease: false
|
129
|
+
version_requirements: *10370880
|
130
|
+
description: ! 'NamespaceHelper provides a module with methods to ease namespace handling.
|
131
|
+
|
132
|
+
For example getting the unprefixed name, the namespace parent or a list of
|
133
|
+
|
134
|
+
namespace components of a class or module.
|
135
|
+
|
136
|
+
'
|
137
|
+
email:
|
138
|
+
- aef@raxys.net
|
139
|
+
executables: []
|
140
|
+
extensions: []
|
141
|
+
extra_rdoc_files:
|
142
|
+
- HISTORY.md
|
143
|
+
- LICENSE.md
|
144
|
+
files:
|
145
|
+
- .gitignore
|
146
|
+
- .rspec
|
147
|
+
- .travis.yml
|
148
|
+
- .yardopts
|
149
|
+
- Gemfile
|
150
|
+
- Gemfile.lock
|
151
|
+
- HISTORY.md
|
152
|
+
- LICENSE.md
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- lib/aef/namespace_helper.rb
|
156
|
+
- lib/namespace_helper.rb
|
157
|
+
- lib/namespace_helper/bare.rb
|
158
|
+
- namespace_helper.gemspec
|
159
|
+
- spec/aef/namespace_helper_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
homepage: http://github.com/aef/namespace_helper
|
162
|
+
licenses:
|
163
|
+
- ISC
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
176
|
+
requirements:
|
177
|
+
- - ! '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 1.8.10
|
183
|
+
signing_key:
|
184
|
+
specification_version: 3
|
185
|
+
summary: Helper methods for class/module namespace handling
|
186
|
+
test_files: []
|
187
|
+
has_rdoc: yard
|
metadata.gz.sig
ADDED
Binary file
|