sugar-high 0.4.6 → 0.4.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.6.1
@@ -15,7 +15,7 @@ end
15
15
  module ClassExt
16
16
  def get_module name
17
17
  # Module.const_get(name)
18
- name.to_s.constantize
18
+ name.to_s.camelize.constantize
19
19
  rescue
20
20
  nil
21
21
  end
@@ -77,7 +77,7 @@ module ClassExt
77
77
 
78
78
  def find_first_module *names
79
79
  modules = names.flatten.compact.uniq.inject([]) do |res, class_name|
80
- found_class = try_class(class_name.to_s.camelize)
80
+ found_class = try_module(class_name.to_s.camelize)
81
81
  res << found_class if found_class
82
82
  res
83
83
  end
@@ -86,4 +86,32 @@ describe ClassExt do
86
86
  trial.module_exists?('Hello').should be_false
87
87
  end
88
88
  end
89
+
90
+ describe '#try_module_only' do
91
+ it 'should find module' do
92
+ trial.try_module_only('Hello').should be_false
93
+ trial.try_module_only('GoodBye').should be_true
94
+ end
95
+ end
96
+
97
+ describe '#find_first_class' do
98
+ it 'should find first class' do
99
+ trial.find_first_class('GoodBye', 'Hello').should == Hello
100
+ end
101
+
102
+ it 'should not find any module' do
103
+ lambda {trial.find_first_class('Good', 'Bye') }.should raise_error
104
+ end
105
+ end
106
+
107
+ describe '#find_first_module' do
108
+ it 'should find first module' do
109
+ first_module = trial.find_first_module('GoodBye::Alpha::Beta', 'Hello')
110
+ first_module.should == GoodBye::Alpha::Beta
111
+ end
112
+
113
+ it 'should not find any module' do
114
+ lambda {trial.find_first_module('Good', 'Bye') }.should raise_error
115
+ end
116
+ end
89
117
  end
data/sugar-high.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.4.6"
8
+ s.version = "0.4.6.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugar-high
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-06-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2153368820 !ruby/object:Gem::Requirement
16
+ requirement: &2157513880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.5'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153368820
24
+ version_requirements: *2157513880
25
25
  description: More Ruby sugar - inspired by the 'zuker' project
26
26
  email: kmandrup@gmail.com
27
27
  executables: []