lib/consty.rb in consty-1.0.0 vs lib/consty.rb in consty-1.0.1

- old
+ new

@@ -24,11 +24,18 @@ if name_sections.first.empty? namespace = Object name_sections = name_sections[1..-1] end + + name_sections.inject(namespace) do |namespace, section| + if namespace.constants.include?(section.to_sym) + namespace.const_get section + else + namespace.const_missing section + end + end - name_sections.inject(namespace) { |c,n| c.const_get n } end end end \ No newline at end of file