open_namespace 0.4.1 → 0.4.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 27c14527e862b51cac2728bd23be2d39d840cc296dd7cf62cf39428a3fbc6c60
4
+ data.tar.gz: f186567025a8c9b3d91b2d1719d9f6c814bc85d5fd152b9335c04c4a4aa8258a
5
+ SHA512:
6
+ metadata.gz: ec0f07fb897e17be72e11db13395d7568327b43509a4a78ac0a3f8358874736ccac4553c933f29bd02777bcb9d139548d912a25b823c20641ba4faf13809d791
7
+ data.tar.gz: d6328b3f3da9a744e462eaeb0e812bd01348a0c3ff0353bae32c9854869833d2920bba6806fd82af56e23b54bc7de57f5a8ab4d68436e27ffd823ff2dda38b69
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - "3.0"
13
+ - "3.1"
14
+ - "3.2"
15
+ - "3.3"
16
+ - jruby
17
+ - truffleruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install --jobs 4 --retry 3
27
+ - name: Run tests
28
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
- pkg
2
- doc
1
+ /Gemfile.lock
2
+ /pkg
3
+ /doc
3
4
  .DS_Store
4
5
  .yardoc
5
6
  *.swp
data/ChangeLog.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### 0.4.2 / 2024-01-24
2
+
3
+ * Switched to using `require_relative` to improve load-times.
4
+ * Added `# frozen_string_literal: true` to all files.
5
+
6
+ ### 0.4.1 / 2012-05-27
7
+
8
+ * Replaced ore-tasks with
9
+ [rubygems-tasks](https://github.com/postmodern/rubygems-tasks#readme).
10
+
1
11
  ### 0.4.0 / 2011-11-19
2
12
 
3
13
  * Added {OpenNamespace.const_lookup}.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+
9
+ gem 'rspec', '~> 3.0'
10
+
11
+ gem 'kramdown'
12
+ gem 'yard', '~> 0.9'
13
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2012 Hal Brodigan
1
+ Copyright (c) 2010-2024 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  * [Source](https://github.com/postmodern/open_namespace)
4
4
  * [Issues](https://github.com/postmodern/open_namespace/issues)
5
5
  * [Documentation](http://rubydoc.info/gems/open_namespace/frames)
6
- * [Email](mailto:postmodern.mod3 at gmail.com)
7
6
 
8
7
  ## Description
9
8
 
@@ -16,58 +15,76 @@ load plugin modules/classes from other gems.
16
15
  * Provides implicit loading of constants via `const_defined?`.
17
16
  * Provides implicit loading of constants via `const_missing`.
18
17
  * Provides explicit loading of constants via `require_const`.
18
+ * Can auto-load other sub-gems (ex: `foo-bar`) from the main gem's namespace
19
+ (ex: `Foo`).
19
20
 
20
21
  ## Examples
21
22
 
22
- Explicit and implicit loading of constants:
23
+ Include it into a namespace:
23
24
 
24
- require 'open_namespace'
25
+ ```ruby
26
+ require 'open_namespace'
25
27
 
26
- module Project
27
- module Plugins
28
- include OpenNamespace
29
- end
30
- end
28
+ module Project
29
+ module Plugins
30
+ include OpenNamespace
31
+ end
32
+ end
33
+ ```
34
+
35
+ Explicitly load constants via their file name:
36
+
37
+ ```ruby
38
+ Project::Plugins.require_const :foo_bar
39
+ # => Project::Plugins::FooBar
40
+ ```
31
41
 
32
- # explicitly load constants
33
- Project::Plguins.require_const :foo_bar
34
- # => Project::Plugins::FooBar
42
+ Explicitly load constants containing uppercase acronyms:
35
43
 
36
- # explicitly load constants with odd capitalization
37
- Project::Plugins.require_const :tcp_session
38
- # => Project::Plugins::TCPSession
44
+ ```ruby
45
+ Project::Plugins.require_const :tcp_session
46
+ # => Project::Plugins::TCPSession
47
+ ```
39
48
 
40
- # explicitly load constants via sub-paths
41
- Project::Plguins.require_const 'templates/erb'
42
- # => Project::Plugins::Templates::Erb
49
+ Explicitly load constants from nested directories:
43
50
 
44
- # implicitly load constants via const_missing
45
- Project::Plugins::Other
46
- # => Project::Plugins::Other
51
+ ```ruby
52
+ Project::Plugins.require_const 'templates/erb'
53
+ # => Project::Plugins::Templates::Erb
54
+ ```
55
+
56
+ Implicitly load constants via `const_missing`:
57
+
58
+ ```ruby
59
+ Project::Plugins::Other
60
+ # => Project::Plugins::Other
61
+ ```
47
62
 
48
63
  Loading constants from alternate namespace root directories:
49
64
 
50
- module Project
51
- module UI
52
- module CommandLine
53
- module Commands
54
- include OpenNamespace
65
+ ```ruby
66
+ module Project
67
+ module UI
68
+ module CommandLine
69
+ module Commands
70
+ include OpenNamespace
55
71
 
56
- self.namespace_root = File.join('project','ui','command_line','commands')
57
- end
58
- end
72
+ self.namespace_root = File.join(__dir__,'commands')
59
73
  end
60
74
  end
75
+ end
76
+ end
61
77
 
62
- Project::UI::CommandLine::Commands.require_const :help
63
- # => Project::UI::CommandLine::Commands::Help
78
+ Project::UI::CommandLine::Commands.require_const :help
79
+ # => Project::UI::CommandLine::Commands::Help
80
+ ```
64
81
 
65
82
  ## Install
66
83
 
67
- $ gem install open_namespace
84
+ ```shell
85
+ $ gem install open_namespace
86
+ ```
68
87
 
69
88
  ## License
70
89
 
71
- Copyright (c) 2010-2012 Hal Brodigan
72
-
73
90
  See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -1,36 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
- begin
5
- gem 'rubygems-tasks', '~> 0.1'
6
- require 'rubygems/tasks'
3
+ require 'rubygems/tasks'
4
+ Gem::Tasks.new
7
5
 
8
- Gem::Tasks.new
9
- rescue LoadError => e
10
- warn e.message
11
- warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
12
- end
13
-
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
17
-
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
24
8
  task :test => :spec
25
9
  task :default => :spec
26
10
 
27
- begin
28
- gem 'yard', '~> 0.7'
29
- require 'yard'
30
-
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new
data/gemspec.yml CHANGED
@@ -7,10 +7,15 @@ description:
7
7
  license: MIT
8
8
  authors: Postmodern
9
9
  email: postmodern.mod3@gmail.com
10
- homepage: https://github.com/postmodern/open_namespace
10
+ homepage: https://github.com/postmodern/open_namespace#readme
11
11
  has_yard: true
12
12
 
13
+ metadata:
14
+ documentation_uri: https://rubydoc.info/gems/open_namespace
15
+ source_code_uri: https://github.com/postmodern/open_namespace
16
+ bug_tracker_uri: https://github.com/postmodern/open_namespace/issues
17
+ changelog_uri: https://github.com/postmodern/open_namespace/blob/main/ChangeLog.md
18
+ rubygems_mfa_required: 'true'
19
+
13
20
  development_dependencies:
14
- rubygems-tasks: ~> 0.1
15
- rspec: ~> 2.4
16
- yard: ~> 0.7
21
+ bundler: ~> 2.0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OpenNamespace
2
4
  module ClassMethods
3
5
  #
@@ -1,4 +1,6 @@
1
- require 'open_namespace/class_methods'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'class_methods'
2
4
 
3
5
  module OpenNamespace
4
6
  def self.included(base)
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OpenNamespace
2
4
  # open_namespace version
3
- VERSION = '0.4.1'
5
+ VERSION = '0.4.2'
4
6
  end
@@ -1,2 +1,4 @@
1
- require 'open_namespace/open_namespace'
2
- require 'open_namespace/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'open_namespace/open_namespace'
4
+ require_relative 'open_namespace/version'
@@ -2,104 +2,57 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- root = File.dirname(__FILE__)
7
- lib_dir = File.join(root,'lib')
8
- files = `git ls-files`.split($/)
9
-
10
- filter_files = lambda { |paths|
11
- files & case paths
12
- when Array
13
- paths
14
- when String
15
- Dir[paths]
16
- end
17
- }
18
-
19
- version = {
20
- :file => 'open_namespace/version',
21
- :constant => 'OpenNamespace::VERSION'
22
- }
23
-
24
- defaults = {
25
- 'name' => File.basename(root),
26
- 'files' => files,
27
- 'require_paths' => ['ext', 'lib'].select { |dir| File.directory?(dir) },
28
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
29
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
30
- 'doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
31
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}']
32
- }
33
-
34
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
35
-
36
- gemspec.name = metadata['name']
37
- gemspec.version = if metadata['version']
38
- metadata['version']
39
- else
40
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
41
-
42
- require version[:file]
43
- eval(version[:constant])
44
- end
45
-
46
- gemspec.summary = metadata.fetch('summary',metadata['description'])
47
- gemspec.description = metadata.fetch('description',metadata['summary'])
48
-
49
- gemspec.licenses = Array(metadata['license'])
50
- gemspec.authors = Array(metadata['authors'])
51
-
52
- gemspec.email = metadata['email']
53
- gemspec.homepage = metadata['homepage']
54
-
55
- gemspec.require_paths = Array(metadata['require_paths'])
56
- gemspec.files = filter_files[metadata['files']]
57
- gemspec.files += Array(metadata['generated_files'])
58
- gemspec.executables = metadata['executables']
59
- gemspec.extensions = metadata['extensions']
60
-
61
- if Gem::VERSION < '1.7.'
62
- gemspec.default_executable = gemspec.executables.first
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
7
+
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ require_relative 'lib/open_namespace/version'
11
+ OpenNamespace::VERSION
12
+ end
13
+
14
+ gem.summary = gemspec['summary']
15
+ gem.description = gemspec['description']
16
+ gem.licenses = Array(gemspec['license'])
17
+ gem.authors = Array(gemspec['authors'])
18
+ gem.email = gemspec['email']
19
+ gem.homepage = gemspec['homepage']
20
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
21
+
22
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
23
+
24
+ gem.files = `git ls-files`.split($/)
25
+ gem.files = glob[gemspec['files']] if gemspec['files']
26
+
27
+ gem.executables = gemspec.fetch('executables') do
28
+ glob['bin/*'].map { |path| File.basename(path) }
63
29
  end
30
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
64
31
 
65
- gemspec.test_files = filter_files[metadata['test_files']]
66
- gemspec.extra_rdoc_files = Array(metadata['extra_doc_files'])
32
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
33
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
34
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
67
35
 
68
- gemspec.post_install_message = metadata['post_install_message']
69
- gemspec.requirements = metadata['requirements']
36
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
37
+ %w[ext lib].select { |dir| File.directory?(dir) }
38
+ })
70
39
 
71
- if gemspec.respond_to?(:required_ruby_version=)
72
- gemspec.required_ruby_version = metadata['required_ruby_version']
73
- end
74
-
75
- if gemspec.respond_to?(:required_rubygems_version=)
76
- gemspec.required_rubygems_version = metadata['required_ruby_version']
77
- end
40
+ gem.requirements = gemspec['requirements']
41
+ gem.required_ruby_version = gemspec['required_ruby_version']
42
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
43
+ gem.post_install_message = gemspec['post_install_message']
78
44
 
79
- parse_versions = lambda { |versions|
80
- case versions
81
- when Array
82
- versions.map { |v| v.to_s }
83
- when String
84
- versions.split(/,\s*/)
85
- end
86
- }
87
-
88
- if metadata['dependencies']
89
- metadata['dependencies'].each do |name,versions|
90
- gemspec.add_dependency(name,parse_versions[versions])
91
- end
92
- end
45
+ split = lambda { |string| string.split(/,\s*/) }
93
46
 
94
- if metadata['runtime_dependencies']
95
- metadata['runtime_dependencies'].each do |name,versions|
96
- gemspec.add_runtime_dependency(name,parse_versions[versions])
47
+ if gemspec['dependencies']
48
+ gemspec['dependencies'].each do |name,versions|
49
+ gem.add_dependency(name,split[versions])
97
50
  end
98
51
  end
99
52
 
100
- if metadata['development_dependencies']
101
- metadata['development_dependencies'].each do |name,versions|
102
- gemspec.add_development_dependency(name,parse_versions[versions])
53
+ if gemspec['development_dependencies']
54
+ gemspec['development_dependencies'].each do |name,versions|
55
+ gem.add_development_dependency(name,split[versions])
103
56
  end
104
57
  end
105
58
  end
@@ -1,160 +1,161 @@
1
- require 'open_namespace/version'
2
-
3
1
  require 'spec_helper'
2
+ require 'open_namespace'
3
+
4
4
  require 'classes/simple_namespace'
5
5
  require 'classes/custom_namespace'
6
6
 
7
7
  describe OpenNamespace do
8
8
  it "should have a VERSION constant" do
9
- OpenNamespace.const_defined?('VERSION').should == true
9
+ expect(OpenNamespace.const_defined?('VERSION')).to be(true)
10
10
  end
11
11
 
12
12
  context "default namespace" do
13
- before(:all) do
14
- @module = Classes::SimpleNamespace
15
- end
13
+ subject { Classes::SimpleNamespace }
16
14
 
17
15
  it "should have the same namespace root as the module's directory" do
18
- @module.namespace_root.should == File.join('classes','simple_namespace')
16
+ expect(subject.namespace_root).to eq(
17
+ File.join('classes','simple_namespace')
18
+ )
19
19
  end
20
20
 
21
21
  it "should load constants into the namespace" do
22
- @module.require_const :constant_one
22
+ subject.require_const :constant_one
23
23
 
24
- @module.should be_const_defined('ConstantOne')
24
+ expect(subject).to be_const_defined('ConstantOne')
25
25
  end
26
26
 
27
27
  it "should find loaded constants in the namespace" do
28
- const = @module.require_const(:constant_one)
28
+ const = subject.require_const(:constant_one)
29
29
 
30
- const.class.should == Class
31
- const.name.should == 'Classes::SimpleNamespace::ConstantOne'
30
+ expect(const.class).to be(Class)
31
+ expect(const.name).to eq('Classes::SimpleNamespace::ConstantOne')
32
32
  end
33
33
 
34
34
  it "should find constants with odd capitalization" do
35
- const = @module.require_const(:odd_constant)
35
+ const = subject.require_const(:odd_constant)
36
36
 
37
- const.class.should == Class
38
- const.name.should == 'Classes::SimpleNamespace::ODDConstant'
37
+ expect(const.class).to be(Class)
38
+ expect(const.name).to eq('Classes::SimpleNamespace::ODDConstant')
39
39
  end
40
40
 
41
41
  it "should load constants via sub-paths" do
42
- @module.require_const File.join('sub','constant_four')
42
+ subject.require_const(File.join('sub','constant_four'))
43
+
44
+ expect(subject).to be_const_defined('Sub')
43
45
 
44
- @module.should be_const_defined('Sub')
45
- @sub = @module.const_get('Sub')
46
+ sub = subject.const_get('Sub')
46
47
 
47
- @sub.should be_const_defined('ConstantFour')
48
+ expect(sub).to be_const_defined('ConstantFour')
48
49
  end
49
50
 
50
51
  it "should find constants loaded via sub-paths" do
51
- const = @module.require_const(File.join('sub','constant_four'))
52
+ const = subject.require_const(File.join('sub','constant_four'))
52
53
 
53
- const.class.should == Class
54
- const.name.should == 'Classes::SimpleNamespace::Sub::ConstantFour'
54
+ expect(const.class).to be(Class)
55
+ expect(const.name).to eq('Classes::SimpleNamespace::Sub::ConstantFour')
55
56
  end
56
57
 
57
58
  it "should return nil on LoadError exceptions" do
58
- const = @module.require_const(:constant_not_found)
59
+ const = subject.require_const(:constant_not_found)
59
60
 
60
- const.should be_nil
61
+ expect(const).to be(nil)
61
62
  end
62
63
 
63
64
  it "should return nil on NameError exceptions" do
64
- const = @module.require_const(:bad_constant)
65
+ const = subject.require_const(:bad_constant)
65
66
 
66
- const.should be_nil
67
+ expect(const).to be(nil)
67
68
  end
68
69
 
69
70
  it "should attempt loading the constant when calling const_defined?" do
70
- @module.const_defined?('ConstantThree').should == true
71
+ expect(subject.const_defined?('ConstantThree')).to be(true)
71
72
  end
72
73
 
73
74
  it "should load constants transparently via const_missing" do
74
- const = @module::ConstantTwo
75
+ const = subject::ConstantTwo
75
76
 
76
- const.class.should == Class
77
- const.name.should == 'Classes::SimpleNamespace::ConstantTwo'
77
+ expect(const.class).to be(Class)
78
+ expect(const.name).to eq('Classes::SimpleNamespace::ConstantTwo')
78
79
  end
79
80
 
80
81
  it "should raise a NameError exception const_missing fails" do
81
- lambda {
82
- @module::BadConstant
83
- }.should raise_error(NameError)
82
+ expect {
83
+ subject::BadConstant
84
+ }.to raise_error(NameError)
84
85
  end
85
86
  end
86
87
 
87
88
  context "custom namespace" do
88
- before(:all) do
89
- @module = Classes::CustomNamespace
90
- end
89
+ subject { Classes::CustomNamespace }
91
90
 
92
91
  it "should have the same namespace root as the module's directory" do
93
- @module.namespace_root.should == File.join('classes','custom')
92
+ expect(subject.namespace_root).to eq(File.join('classes','custom'))
94
93
  end
95
94
 
96
95
  it "should load constants into the namespace" do
97
- @module.require_const :constant_one
98
- @module.should be_const_defined('ConstantOne')
96
+ subject.require_const(:constant_one)
97
+
98
+ expect(subject).to be_const_defined('ConstantOne')
99
99
  end
100
100
 
101
101
  it "should find loaded constants in the namespace" do
102
- const = @module.require_const(:constant_one)
102
+ const = subject.require_const(:constant_one)
103
103
 
104
- const.class.should == Class
105
- const.name.should == 'Classes::CustomNamespace::ConstantOne'
104
+ expect(const.class).to be(Class)
105
+ expect(const.name).to eq('Classes::CustomNamespace::ConstantOne')
106
106
  end
107
107
 
108
108
  it "should find constants with odd capitalization" do
109
- const = @module.require_const(:odd_constant)
109
+ const = subject.require_const(:odd_constant)
110
110
 
111
- const.class.should == Class
112
- const.name.should == 'Classes::CustomNamespace::ODDConstant'
111
+ expect(const.class).to be(Class)
112
+ expect(const.name).to eq('Classes::CustomNamespace::ODDConstant')
113
113
  end
114
114
 
115
115
  it "should load constants via sub-paths" do
116
- @module.require_const File.join('sub','constant_four')
116
+ subject.require_const File.join('sub','constant_four')
117
+
118
+ expect(subject).to be_const_defined('Sub')
117
119
 
118
- @module.should be_const_defined('Sub')
119
- @sub = @module.const_get('Sub')
120
+ sub = subject.const_get('Sub')
120
121
 
121
- @sub.should be_const_defined('ConstantFour')
122
+ expect(sub).to be_const_defined('ConstantFour')
122
123
  end
123
124
 
124
125
  it "should find constants loaded via sub-paths" do
125
- const = @module.require_const(File.join('sub','constant_four'))
126
+ const = subject.require_const(File.join('sub','constant_four'))
126
127
 
127
- const.class.should == Class
128
- const.name.should == 'Classes::CustomNamespace::Sub::ConstantFour'
128
+ expect(const.class).to be(Class)
129
+ expect(const.name).to eq('Classes::CustomNamespace::Sub::ConstantFour')
129
130
  end
130
131
 
131
132
  it "should return nil on LoadError exceptions" do
132
- const = @module.require_const(:constant_not_found)
133
+ const = subject.require_const(:constant_not_found)
133
134
 
134
- const.should be_nil
135
+ expect(const).to be_nil
135
136
  end
136
137
 
137
138
  it "should return nil on NameError exceptions" do
138
- const = @module.require_const(:bad_constant)
139
+ const = subject.require_const(:bad_constant)
139
140
 
140
- const.should be_nil
141
+ expect(const).to be_nil
141
142
  end
142
143
 
143
144
  it "should attempt loading the constant when calling const_defined?" do
144
- @module.const_defined?('ConstantThree').should == true
145
+ expect(subject.const_defined?('ConstantThree')).to be(true)
145
146
  end
146
147
 
147
148
  it "should load constants transparently via const_missing" do
148
- const = @module::ConstantTwo
149
+ const = subject::ConstantTwo
149
150
 
150
- const.class.should == Class
151
- const.name.should == 'Classes::CustomNamespace::ConstantTwo'
151
+ expect(const.class).to be(Class)
152
+ expect(const.name).to eq('Classes::CustomNamespace::ConstantTwo')
152
153
  end
153
154
 
154
155
  it "should raise a NameError exception const_missing fails" do
155
- lambda {
156
- @module::BadConstant
157
- }.should raise_error(NameError)
156
+ expect {
157
+ subject::BadConstant
158
+ }.to raise_error(NameError)
158
159
  end
159
160
  end
160
161
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,4 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
3
-
4
2
  require 'open_namespace/version'
5
3
 
6
4
  include OpenNamespace
metadata CHANGED
@@ -1,84 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: open_namespace
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Postmodern
14
- autorequire:
8
+ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-05-28 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: yard
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 0
31
- - 7
32
- version: "0.7"
33
- type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rubygems-tasks
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 9
44
- segments:
45
- - 0
46
- - 1
47
- version: "0.1"
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
48
20
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rspec
52
21
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 11
59
- segments:
60
- - 2
61
- - 4
62
- version: "2.4"
63
- type: :development
64
- version_requirements: *id003
65
- description: OpenNamespace allows namespaces to require and find classes and modules from other RubyGems.
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ description: OpenNamespace allows namespaces to require and find classes and modules
28
+ from other RubyGems.
66
29
  email: postmodern.mod3@gmail.com
67
30
  executables: []
68
-
69
31
  extensions: []
70
-
71
- extra_rdoc_files:
32
+ extra_rdoc_files:
72
33
  - ChangeLog.md
73
34
  - LICENSE.txt
74
35
  - README.md
75
- files:
76
- - .document
77
- - .gemtest
78
- - .gitignore
79
- - .rspec
80
- - .yardopts
36
+ files:
37
+ - ".document"
38
+ - ".gemtest"
39
+ - ".github/workflows/ruby.yml"
40
+ - ".gitignore"
41
+ - ".rspec"
42
+ - ".yardopts"
81
43
  - ChangeLog.md
44
+ - Gemfile
82
45
  - LICENSE.txt
83
46
  - README.md
84
47
  - Rakefile
@@ -104,38 +67,32 @@ files:
104
67
  - spec/classes/simple_namespace/sub/constant_four.rb
105
68
  - spec/open_namespace_spec.rb
106
69
  - spec/spec_helper.rb
107
- homepage: https://github.com/postmodern/open_namespace
108
- licenses:
70
+ homepage: https://github.com/postmodern/open_namespace#readme
71
+ licenses:
109
72
  - MIT
110
- post_install_message:
73
+ metadata:
74
+ documentation_uri: https://rubydoc.info/gems/open_namespace
75
+ source_code_uri: https://github.com/postmodern/open_namespace
76
+ bug_tracker_uri: https://github.com/postmodern/open_namespace/issues
77
+ changelog_uri: https://github.com/postmodern/open_namespace/blob/main/ChangeLog.md
78
+ rubygems_mfa_required: 'true'
79
+ post_install_message:
111
80
  rdoc_options: []
112
-
113
- require_paths:
81
+ require_paths:
114
82
  - lib
115
- required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
118
85
  - - ">="
119
- - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
- version: "0"
124
- required_rubygems_version: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
127
90
  - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
133
93
  requirements: []
134
-
135
- rubyforge_project:
136
- rubygems_version: 1.8.23
137
- signing_key:
138
- specification_version: 3
94
+ rubygems_version: 3.4.10
95
+ signing_key:
96
+ specification_version: 4
139
97
  summary: Allows namespaces to load constants on-demand
140
- test_files:
141
- - spec/open_namespace_spec.rb
98
+ test_files: []