Permalink
Browse files

Fix camelcase and location of eigen.

  • Loading branch information...
1 parent 7efbdeb commit c4a88d10e7cca89040f79eb6e108058e9eb8e198 @trans trans committed Dec 31, 2011
View
1 lib/core/facets/kernel.rb
@@ -16,6 +16,7 @@
require_relative 'kernel/deep_copy.rb'
#require_relative 'kernel/demo.rb' # uncommon
require_relative 'kernel/disable_warnings.rb'
+require_relative 'kernel/eigen.rb'
#require_relative 'kernel/eigenclass.rb' # uncommon
require_relative 'kernel/enable_warnings.rb'
require_relative 'kernel/equate.rb'
View
2 lib/core/facets/kernel/eigen.rb
@@ -21,7 +21,7 @@ module Kernel
# and overly used term that 'eigen' was decided upon as a better
# choice. You can thank or blame _why for the term, if you like.
#
- class eigen
+ def eigen
Functor.new do |op,*a,&b|
(class << self; self; end).class_eval do
__send__(op,*a,&b)
View
2 lib/core/facets/module.rb
@@ -21,8 +21,6 @@
#require_relative 'module/class_inheritor.rb' # uncommon
require_relative 'module/class_method_defined.rb'
#require_relative 'module/copy_inheritor.rb' # uncommon
-require_relative 'module/eigen.rb'
-require_relative 'module/eigenclass.rb'
#require_relative 'module/enclosure.rb' # uncommon
#require_relative 'module/enclosures.rb' # uncommon
require_relative 'module/extend.rb'
View
9 lib/core/facets/string/camelcase.rb
@@ -22,7 +22,10 @@ class String
# If that is what you are looking for you may want {#modulize}.
#
def camelcase(*separators)
- first_letter = separators.shift if Symbol === separators.first
+ case separators.first
+ when Symbol, TrueClass, FalseClass, NilClass
+ first_letter = separators.shift
+ end
separators = ['_', '\s'] if separators.empty?
@@ -33,9 +36,9 @@ def camelcase(*separators)
end
case first_letter
- when :upper
+ when :upper, true
str = str.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase }
- when :lower
+ when :lower, false
str = str.gsub(/(\A|\s)([A-Z])/){ $1 + $2.downcase }
end

0 comments on commit c4a88d1

Please sign in to comment.