modularity 0.3.1 → 0.4.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -4,22 +4,25 @@ module Modularity
4
4
  class Inflector
5
5
  class << self
6
6
 
7
- # File activesupport/lib/active_support/inflector.rb, line 160
7
+ # File activesupport/lib/active_support/inflector.rb, line 178
8
8
  def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
9
9
  if first_letter_in_uppercase
10
10
  lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
11
11
  else
12
- lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]
12
+ lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
13
13
  end
14
14
  end
15
15
 
16
- # File activesupport/lib/active_support/inflector.rb, line 278
16
+ # File activesupport/lib/active_support/inflector.rb, line 355
17
17
  def constantize(camel_cased_word)
18
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
19
- raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
20
- end
18
+ names = camel_cased_word.split('::')
19
+ names.shift if names.empty? || names.first.empty?
21
20
 
22
- Object.module_eval("::#{$1}", __FILE__, __LINE__)
21
+ constant = Object
22
+ names.each do |name|
23
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
24
+ end
25
+ constant
23
26
  end
24
27
 
25
28
  end
data/modularity.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{modularity}
8
- s.version = "0.3.1"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modularity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch