module_with_params 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d76bd675f6e25b494b4c3061bff64a1fce309636
4
+ data.tar.gz: 8b8fbae61bf282e664a22aa6fe894951e82f32f3
5
+ SHA512:
6
+ metadata.gz: 8b316f6aa5bd004841911432627b2fcd513549b3cb2b7fb267953011c297bdd2a8fd5fc7a6476c75a81c6d9bc671e5c09acf6e004a15e0b278a970b73a6774e3
7
+ data.tar.gz: 2788e077f0ef580c09e7f86a4e4a4e34e250bebfcd8379bbca1ffd92482a7e90f83e9535c3cdac5f3b48070039e133cd6b69eebe495a54ccf5f08c14341fac63
@@ -8,10 +8,11 @@ module ModuleWithParams
8
8
  module ClassMethods
9
9
  def [](*args)
10
10
  m = self
11
+ name = m.name.split('::').last
11
12
 
12
13
  Module.new do
13
14
  include m
14
- define_method(:"_#{m.name}_module_options"){ (args.size == 1) ? args[0] : args }
15
+ define_method(:"_#{name}_module_options"){ (args.size == 1) ? args[0] : args }
15
16
  end
16
17
 
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module ModuleWithParams
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -19,6 +19,13 @@ module TestModuleArray
19
19
  _TestModuleArray_module_options[1]
20
20
  end
21
21
 
22
+ module NestedModule
23
+ include ModuleWithParams
24
+
25
+ def number
26
+ _NestedModule_module_options
27
+ end
28
+ end
22
29
  end
23
30
 
24
31
  describe 'Module with params' do
@@ -45,4 +52,12 @@ describe 'Module with params' do
45
52
  obj.second.should == 43
46
53
  end
47
54
 
55
+ should 'handle nested modules' do
56
+ cl = Class.new do
57
+ include TestModuleArray::NestedModule[5]
58
+ end
59
+ obj = cl.new
60
+ obj.number.should == 5
61
+ end
62
+
48
63
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: module_with_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Julien Ammous
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-01-24 00:00:00.000000000 Z
11
+ date: 2015-01-13 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: include module with parameters
15
14
  email: []
@@ -17,7 +16,7 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
20
- - .gitignore
19
+ - ".gitignore"
21
20
  - Gemfile
22
21
  - README.md
23
22
  - Rakefile
@@ -28,32 +27,25 @@ files:
28
27
  - specs/module_with_params_spec.rb
29
28
  homepage: ''
30
29
  licenses: []
30
+ metadata: {}
31
31
  post_install_message:
32
32
  rdoc_options: []
33
33
  require_paths:
34
34
  - lib
35
35
  required_ruby_version: !ruby/object:Gem::Requirement
36
- none: false
37
36
  requirements:
38
- - - ! '>='
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
- segments:
42
- - 0
43
- hash: 2944426835664010523
44
40
  required_rubygems_version: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
- - - ! '>='
42
+ - - ">="
48
43
  - !ruby/object:Gem::Version
49
44
  version: '0'
50
- segments:
51
- - 0
52
- hash: 2944426835664010523
53
45
  requirements: []
54
46
  rubyforge_project:
55
- rubygems_version: 1.8.15
47
+ rubygems_version: 2.2.2
56
48
  signing_key:
57
- specification_version: 3
49
+ specification_version: 4
58
50
  summary: module with parameters
59
51
  test_files: []