name_space 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b87b16051da3ef6fc303bf4a167f34a7310021be1126a5341acce3073bfbb6f8
4
+ data.tar.gz: 9a7eef35be0b1f3e01cb310a92deee1a343d22bd0fdcebde0999589c43a0e8db
5
+ SHA512:
6
+ metadata.gz: '09d323369968ead503e81b5a6b99f03b0050bb51e4642421963a267969a5dead86635363cf1bfedb381535eb1dad1bb4384bfe1990e1519342be082f5a6d0581'
7
+ data.tar.gz: f8783cd5b700add3521810e0950295af14e1955126486c114862f1980fce4578f887a9ec20ef171576d6f5e5aacea8da90b117aaf05e01d3c6ade8c487afbeb9
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 fntzr <fantazuor@gmail.com>
1
+ Copyright (c) 2013-2018 fntz <mike.fch1@gmail.com>
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,151 +1,157 @@
1
- # Namespace
2
-
3
- Include and Extend your class with Namespace.
4
- Method with the same name in different namespaces.
5
-
6
- ## Installation
7
-
8
- Add this line to your application's Gemfile:
9
-
10
- gem 'namespace'
11
-
12
- And then execute:
13
-
14
- $ bundle
15
-
16
- Or install it yourself as:
17
-
18
- $ gem install namespace
19
-
20
- # Usage
21
-
22
- ## Define namespace with methods.
23
-
24
- * name - [Symbol] - namespace name,
25
-
26
- * block - []Block] with methods
27
-
28
- ```ruby
29
- class SomeClass
30
- include Namespace
31
- extend Namespace
32
-
33
- namespace :my_namespace do
34
- def method_a
35
- 'method_a'
36
- end
37
- end
38
- end
39
-
40
- # For Instance
41
- SomeClass.new.my_namespace.method_a # => 'method_a'
42
- # For class
43
- SomeClass.my_namespace.method_a # => 'method_a'
44
- ```
45
- ## Outer methods
46
-
47
- All *namespaces* can call outer methods.
48
- ```ruby
49
- class SomeClass
50
- include Namespace
51
- extend Namespace
52
-
53
- def outer
54
- 'outer'
55
- end
56
-
57
- namespace :my_namespace do
58
- def method_a
59
- outer
60
- end
61
- end
62
- end
63
-
64
- SomeClass.new.my_namespace.method_a #=> outer
65
- ```
66
-
67
- ## Take all namespaces for class with `namespaces` method
68
- ```ruby
69
- class SomeClass
70
- include Namespace
71
- extend Namespace
72
-
73
- namespace :a do
74
- end
75
- namespace :b do
76
- end
77
- namespace :c do
78
- end
79
- end
80
-
81
- SomeClass.new.namespaces # => [:a, :b, :c]
82
- ```
83
-
84
- ## Reopen namespace.
85
-
86
- You can reopen any namespace
87
- ```ruby
88
- class SomeClass
89
- include Namespace
90
- extend Namespace
91
-
92
- namespace :a do
93
- def a; 'a' end
94
- end
95
- namespace :a do
96
- def b; 'b' end
97
- end
98
- end
99
-
100
- SomeClass.a.a # => 'a'
101
- SomeClass.a.b # => 'b'
102
- ```
103
-
104
- ##Namespaces and Inheritance.
105
-
106
- All namespaces from superclass available in subclasses.
107
- ```ruby
108
- class SomeClass
109
- include Namespace
110
- extend Namespace
111
-
112
- namespace :a do
113
- def a; 'super' end
114
- end
115
- end
116
-
117
- class SubSomeClass < SomeClass
118
- namespace :a do
119
- def 'a'; 'subclass' end
120
- end
121
- end
122
-
123
- SubSomeClass.a.a # => 'subclass'
124
- ```
125
-
126
- ##Namespaces with Rails.
127
-
128
- It can be use for save scopes (for example).
129
- ```ruby
130
- class Model < AR::B
131
- include Namespace
132
- extend Namespace
133
-
134
- scope :lasts, ->{ }
135
- namespace :my_custom_scopes do
136
- scope :lasts, ->{ }
137
- end
138
- end
139
-
140
- Model.lasts # => return from "lasts" scope
141
- Model.my_custom_scopes.lasts # => return from namespace scope, "lasts" scope will be override
142
- ```
143
-
144
-
145
- ## Contributing
146
-
147
- 1. Fork it
148
- 2. Create your feature branch (`git checkout -b my-new-feature`)
149
- 3. Commit your changes (`git commit -am 'Add some feature'`)
150
- 4. Push to the branch (`git push origin my-new-feature`)
151
- 5. Create new Pull Request
1
+ # Namespace
2
+
3
+ Include and Extend your class with Namespace.
4
+ Method with the same name in different namespaces.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+ ```ruby
10
+ gem 'name_space'
11
+ ```
12
+ And then execute:
13
+ ```ruby
14
+ $ bundle
15
+ ```
16
+ Or install it yourself as:
17
+ ```ruby
18
+ $ gem install name_space
19
+ ```
20
+ Require gem:
21
+ ```ruby
22
+ require 'namespace'
23
+ ```
24
+
25
+
26
+ # Usage
27
+
28
+ ## Define namespace with methods.
29
+
30
+ * name - [Symbol] - namespace name,
31
+
32
+ * block - [Block] with methods
33
+
34
+ ```ruby
35
+ class SomeClass
36
+ include Namespace
37
+ extend Namespace
38
+
39
+ namespace :my_namespace do
40
+ def method_a
41
+ 'method_a'
42
+ end
43
+ end
44
+ end
45
+
46
+ # For Instance
47
+ SomeClass.new.my_namespace.method_a # => 'method_a'
48
+ # For class
49
+ SomeClass.my_namespace.method_a # => 'method_a'
50
+ ```
51
+ ## Outer methods
52
+
53
+ All *namespaces* can call outer methods.
54
+ ```ruby
55
+ class SomeClass
56
+ include Namespace
57
+ extend Namespace
58
+
59
+ def outer
60
+ 'outer'
61
+ end
62
+
63
+ namespace :my_namespace do
64
+ def method_a
65
+ outer
66
+ end
67
+ end
68
+ end
69
+
70
+ SomeClass.new.my_namespace.method_a #=> outer
71
+ ```
72
+
73
+ ## Get all namespaces for class with `namespaces` method
74
+ ```ruby
75
+ class SomeClass
76
+ include Namespace
77
+ extend Namespace
78
+
79
+ namespace :a do
80
+ end
81
+ namespace :b do
82
+ end
83
+ namespace :c do
84
+ end
85
+ end
86
+
87
+ SomeClass.new.namespaces # => [:a, :b, :c]
88
+ ```
89
+
90
+ ## Reopen namespace.
91
+
92
+ You can reopen any namespace
93
+ ```ruby
94
+ class SomeClass
95
+ include Namespace
96
+ extend Namespace
97
+
98
+ namespace :a do
99
+ def a; 'a' end
100
+ end
101
+ namespace :a do
102
+ def b; 'b' end
103
+ end
104
+ end
105
+
106
+ SomeClass.a.a # => 'a'
107
+ SomeClass.a.b # => 'b'
108
+ ```
109
+
110
+ ##Namespaces and Inheritance.
111
+
112
+ All namespaces from superclass available in subclasses.
113
+ ```ruby
114
+ class SomeClass
115
+ include Namespace
116
+ extend Namespace
117
+
118
+ namespace :a do
119
+ def a; 'super' end
120
+ end
121
+ end
122
+
123
+ class SubSomeClass < SomeClass
124
+ namespace :a do
125
+ def 'a'; 'subclass' end
126
+ end
127
+ end
128
+
129
+ SubSomeClass.a.a # => 'subclass'
130
+ ```
131
+
132
+ ##Namespaces with Rails.
133
+
134
+ It can be use for save scopes (for example).
135
+ ```ruby
136
+ class Model < AR::B
137
+ include Namespace
138
+ extend Namespace
139
+
140
+ scope :lasts, ->{ }
141
+ namespace :my_custom_scopes do
142
+ scope :lasts, ->{ }
143
+ end
144
+ end
145
+
146
+ Model.lasts # => return from "lasts" scope
147
+ Model.my_custom_scopes.lasts # => return from namespace scope, "lasts" scope will be override
148
+ ```
149
+
150
+
151
+ ## Contributing
152
+
153
+ 1. Fork it
154
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
155
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
156
+ 4. Push to the branch (`git push origin my-new-feature`)
157
+ 5. Create new Pull Request
@@ -1,3 +1,3 @@
1
1
  module Namespace
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -6,15 +6,16 @@ require 'namespace/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "name_space"
8
8
  gem.version = Namespace::VERSION
9
- gem.authors = ["fntzr"]
10
- gem.email = ["fantazuor@gmail.com"]
9
+ gem.authors = ["fntz"]
10
+ gem.email = ["mike.fch1@gmail.com"]
11
11
  gem.description = "Add Namespace functionality"
12
12
  gem.summary = "Include and Extend your class with Namespace. Create methods with the same name in different namespaces."
13
- gem.homepage = "https://github.com/fntzr/namespace"
13
+ gem.homepage = 'https://github.com/fntz/namespace'
14
+ gem.license = 'MIT'
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.test_files = gem.files.grep(%r{^(spec|spec|features)/})
17
18
  gem.require_paths = ["lib"]
18
19
 
19
- gem.add_development_dependency('rspec', [">= 2.0.0"])
20
+ gem.add_development_dependency 'rspec', '~> 2.0', '>= 2.0.0'
20
21
  end
@@ -130,9 +130,9 @@ describe Namespace do
130
130
  end
131
131
 
132
132
  it "return all method from namespace" do
133
- D.a.nmethods.should eq [:a, :b, :c]
133
+ D.a.nmethods.should =~ [:a, :b, :c]
134
134
  D.b.nmethods.should eq [:a]
135
- D.new.a.nmethods.should eq [:a, :b, :c]
135
+ D.new.a.nmethods.should =~ [:a, :b, :c]
136
136
  D.new.b.nmethods.should eq [:a]
137
137
  end
138
138
  end
metadata CHANGED
@@ -1,41 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: name_space
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
- - fntzr
7
+ - fntz
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-03 00:00:00.000000000 Z
11
+ date: 2018-11-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: 2.0.0
22
23
  type: :development
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
28
31
  - !ruby/object:Gem::Version
29
32
  version: 2.0.0
30
33
  description: Add Namespace functionality
31
34
  email:
32
- - fantazuor@gmail.com
35
+ - mike.fch1@gmail.com
33
36
  executables: []
34
37
  extensions: []
35
38
  extra_rdoc_files: []
36
39
  files:
37
- - .gitignore
38
- - .rspec
40
+ - ".gitignore"
41
+ - ".rspec"
39
42
  - Gemfile
40
43
  - LICENSE.txt
41
44
  - README.md
@@ -47,32 +50,31 @@ files:
47
50
  - namespace.gemspec
48
51
  - spec/namespace_spec.rb
49
52
  - spec/spec_helper.rb
50
- homepage: https://github.com/fntzr/namespace
51
- licenses: []
53
+ homepage: https://github.com/fntz/namespace
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
52
57
  post_install_message:
53
58
  rdoc_options: []
54
59
  require_paths:
55
60
  - lib
56
61
  required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
62
  requirements:
59
- - - ! '>='
63
+ - - ">="
60
64
  - !ruby/object:Gem::Version
61
65
  version: '0'
62
66
  required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
67
  requirements:
65
- - - ! '>='
68
+ - - ">="
66
69
  - !ruby/object:Gem::Version
67
70
  version: '0'
68
71
  requirements: []
69
72
  rubyforge_project:
70
- rubygems_version: 1.8.25
73
+ rubygems_version: 2.7.6
71
74
  signing_key:
72
- specification_version: 3
75
+ specification_version: 4
73
76
  summary: Include and Extend your class with Namespace. Create methods with the same
74
77
  name in different namespaces.
75
78
  test_files:
76
79
  - spec/namespace_spec.rb
77
80
  - spec/spec_helper.rb
78
- has_rdoc: