Permalink
Browse files

renamed ActiveSupport::ASC to MonkeySupport::C

  • Loading branch information...
1 parent 85aa353 commit 6dd699e0ceafbc386039271b9b94868d521dcad7 Burke Libbey committed Sep 4, 2009
Showing with 39 additions and 200 deletions.
  1. +1 −0 .gitignore
  2. +0 −157 ext/Makefile
  3. +0 −27 ext/active_support_c.c
  4. +1 −1 ext/extconf.rb
  5. +27 −0 ext/monkeysupport_c.c
  6. +1 −3 lib/monkeysupport.rb
  7. +0 −1 lib/monkeysupport/.#util.rb
  8. +8 −7 lib/monkeysupport/inflector.rb
  9. +1 −4 monkeysupport.gemspec
View
@@ -7,3 +7,4 @@ pkg
*.so
*.dll
*.o
+Makefile
View
@@ -1,157 +0,0 @@
-
-SHELL = /bin/sh
-
-#### Start of system configuration section. ####
-
-srcdir = .
-topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
-hdrdir = $(topdir)
-VPATH = $(srcdir):$(topdir):$(hdrdir)
-exec_prefix = $(prefix)
-prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
-sharedstatedir = $(prefix)/com
-mandir = $(DESTDIR)/usr/share/man
-psdir = $(docdir)
-oldincludedir = $(DESTDIR)/usr/include
-localedir = $(datarootdir)/locale
-bindir = $(exec_prefix)/bin
-libexecdir = $(exec_prefix)/libexec
-sitedir = $(DESTDIR)/Library/Ruby/Site
-htmldir = $(docdir)
-vendorarchdir = $(vendorlibdir)/$(sitearch)
-includedir = $(prefix)/include
-infodir = $(DESTDIR)/usr/share/info
-vendorlibdir = $(vendordir)/$(ruby_version)
-sysconfdir = $(prefix)/etc
-libdir = $(exec_prefix)/lib
-sbindir = $(exec_prefix)/sbin
-rubylibdir = $(libdir)/ruby/$(ruby_version)
-docdir = $(datarootdir)/doc/$(PACKAGE)
-dvidir = $(docdir)
-vendordir = $(libdir)/ruby/vendor_ruby
-datarootdir = $(prefix)/share
-pdfdir = $(docdir)
-archdir = $(rubylibdir)/$(arch)
-sitearchdir = $(sitelibdir)/$(sitearch)
-datadir = $(datarootdir)
-localstatedir = $(prefix)/var
-sitelibdir = $(sitedir)/$(ruby_version)
-
-CC = gcc
-LIBRUBY = $(LIBRUBY_SO)
-LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
-LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
-LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
-
-RUBY_EXTCONF_H =
-CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
-INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
-DEFS =
-CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
-CXXFLAGS = $(CFLAGS)
-ldflags = -L. -arch i386 -arch x86_64
-dldflags =
-archflag =
-DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
-LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
-AR = ar
-EXEEXT =
-
-RUBY_INSTALL_NAME = ruby
-RUBY_SO_NAME = ruby
-arch = universal-darwin10.0
-sitearch = universal-darwin10.0
-ruby_version = 1.8
-ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
-RUBY = $(ruby)
-RM = rm -f
-MAKEDIRS = mkdir -p
-INSTALL = /usr/bin/install -c
-INSTALL_PROG = $(INSTALL) -m 0755
-INSTALL_DATA = $(INSTALL) -m 644
-COPY = cp
-
-#### End of system configuration section. ####
-
-preload =
-
-libpath = . $(libdir)
-LIBPATH = -L. -L$(libdir)
-DEFFILE =
-
-CLEANFILES = mkmf.log
-DISTCLEANFILES =
-
-extout =
-extout_prefix =
-target_prefix =
-LOCAL_LIBS =
-LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl
-SRCS = active_support_c.c inflector.c
-OBJS = active_support_c.o inflector.o
-TARGET = active_support_c
-DLLIB = $(TARGET).bundle
-EXTSTATIC =
-STATIC_LIB =
-
-BINDIR = $(bindir)
-RUBYCOMMONDIR = $(sitedir)$(target_prefix)
-RUBYLIBDIR = $(sitelibdir)$(target_prefix)
-RUBYARCHDIR = $(sitearchdir)$(target_prefix)
-
-TARGET_SO = $(DLLIB)
-CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
-CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
-
-all: $(DLLIB)
-static: $(STATIC_LIB)
-
-clean:
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
-
-distclean: clean
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
-
-realclean: distclean
-install: install-so install-rb
-
-install-so: $(RUBYARCHDIR)
-install-so: $(RUBYARCHDIR)/$(DLLIB)
-$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
-install-rb: pre-install-rb install-rb-default
-install-rb-default: pre-install-rb-default
-pre-install-rb: Makefile
-pre-install-rb-default: Makefile
-$(RUBYARCHDIR):
- $(MAKEDIRS) $@
-
-site-install: site-install-so site-install-rb
-site-install-so: install-so
-site-install-rb: install-rb
-
-.SUFFIXES: .c .m .cc .cxx .cpp .C .o
-
-.cc.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.cxx.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.cpp.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.C.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.c.o:
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
-
-$(DLLIB): $(OBJS)
- @-$(RM) $@
- $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
-
-
-
-$(OBJS): ruby.h defines.h
View
@@ -1,27 +0,0 @@
-#include "inflector.h"
-#include "core_ext/string/starts_ends_with.h"
-#include "core_ext/string/access.h"
-#include "core_ext/string/filters.h"
-
-#include "ruby.h"
-
-void
-Init_active_support_c()
-{
- VALUE mActiveSupport = rb_define_module("ActiveSupport");
- VALUE cASC = rb_define_class_under(mActiveSupport, "ASC", rb_cObject);
-
- /* ActiveSupport::ASC.camelize("my_string") */
- rb_define_singleton_method(cASC, "inflector_camelize", inflector_camelize, 2);
- rb_define_singleton_method(cASC, "inflector_demodulize", inflector_demodulize, 1);
- rb_define_singleton_method(cASC, "inflector_dasherize", inflector_dasherize, 1);
- rb_define_singleton_method(cASC, "inflector_foreign_key", inflector_foreign_key, 2);
- rb_define_singleton_method(cASC, "inflector_ordinalize", inflector_ordinalize, 1);
- rb_define_singleton_method(cASC, "inflector_parameterize", inflector_parameterize, 2);
- rb_define_singleton_method(cASC, "inflector_underscore", inflector_underscore, 1);
-
-/* rb_define_singleton_method(cASC, "core_ext_string_at", core_ext_string_at, 1); */
-/* rb_define_singleton_method(cASC, "core_ext_string_to", core_ext_string_to, 1); */
-/* rb_define_singleton_method(cASC, "core_ext_string_from", core_ext_string_from, 1); */
-/* rb_define_singleton_method(cASC, "core_ext_string_first", core_ext_string_first, 1); */
-}
View
@@ -1,4 +1,4 @@
require 'mkmf'
-extension_name = 'active_support_c'
+extension_name = 'monkeysupport_c'
dir_config(extension_name)
create_makefile(extension_name)
View
@@ -0,0 +1,27 @@
+#include "inflector.h"
+#include "core_ext/string/starts_ends_with.h"
+#include "core_ext/string/access.h"
+#include "core_ext/string/filters.h"
+
+#include "ruby.h"
+
+void
+Init_monkeysupport_c()
+{
+ VALUE mMonkeySupport = rb_define_module("MonkeySupport");
+ VALUE cMSC = rb_define_class_under(mMonkeySupport, "C", rb_cObject);
+
+ /* ActiveSupport::ASC.camelize("my_string") */
+ rb_define_singleton_method(cMSC, "inflector_camelize", inflector_camelize, 2);
+ rb_define_singleton_method(cMSC, "inflector_demodulize", inflector_demodulize, 1);
+ rb_define_singleton_method(cMSC, "inflector_dasherize", inflector_dasherize, 1);
+ rb_define_singleton_method(cMSC, "inflector_foreign_key", inflector_foreign_key, 2);
+ rb_define_singleton_method(cMSC, "inflector_ordinalize", inflector_ordinalize, 1);
+ rb_define_singleton_method(cMSC, "inflector_parameterize", inflector_parameterize, 2);
+ rb_define_singleton_method(cMSC, "inflector_underscore", inflector_underscore, 1);
+
+/* rb_define_singleton_method(cMSC, "core_ext_string_at", core_ext_string_at, 1); */
+/* rb_define_singleton_method(cMSC, "core_ext_string_to", core_ext_string_to, 1); */
+/* rb_define_singleton_method(cMSC, "core_ext_string_from", core_ext_string_from, 1); */
+/* rb_define_singleton_method(cMSC, "core_ext_string_first", core_ext_string_first, 1); */
+}
View
@@ -1,7 +1,5 @@
-module MonkeySupport
-end
+require 'monkeysupport_c'
require 'monkeysupport/type_checks'
require 'monkeysupport/memoizable'
-require 'active_support_c'
require 'monkeysupport/inflector'
@@ -3,12 +3,13 @@ module Inflector
extend MonkeySupport::Memoizable
extend MonkeySupport::TypeChecks
+
monkey_memoize :pluralize, :singularize, :humanize
alias_method :__camelize, :camelize
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
if is_ascii_string?(lower_case_and_underscored_word)
- ActiveSupport::ASC.inflector_camelize(lower_case_and_underscored_word.to_s, first_letter_in_uppercase)
+ MonkeySupport::C.inflector_camelize(lower_case_and_underscored_word.to_s, first_letter_in_uppercase)
else
__camelize(lower_case_and_underscored_word, first_letter_in_uppercase)
end
@@ -17,7 +18,7 @@ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
alias_method :__underscore, :underscore
def underscore(camel_cased_word)
if is_ascii_string?(camel_cased_word)
- ActiveSupport::ASC.inflector_underscore(camel_cased_word)
+ MonkeySupport::C.inflector_underscore(camel_cased_word)
else
__underscore(camel_cased_word)
end
@@ -26,7 +27,7 @@ def underscore(camel_cased_word)
alias_method :__dasherize, :dasherize
def dasherize(underscored_word)
if is_ascii_string?(underscored_word)
- ActiveSupport::ASC.inflector_dasherize(underscored_word)
+ MonkeySupport::C.inflector_dasherize(underscored_word)
else
__dasherize(underscored_word)
end
@@ -35,7 +36,7 @@ def dasherize(underscored_word)
alias_method :__demodulize, :demodulize
def demodulize(class_name_in_module)
if is_ascii_string?(class_name_in_module)
- ActiveSupport::ASC.inflector_demodulize(class_name_in_module)
+ MonkeySupport::C.inflector_demodulize(class_name_in_module)
else
__demodulize(class_name_in_module)
end
@@ -45,7 +46,7 @@ def demodulize(class_name_in_module)
def parameterize(string, sep = '-')
parameterized_string = transliterate(string)
if is_ascii_string?(parameterized_string) && is_ascii_string?(sep)
- ActiveSupport::ASC.inflector_parameterize(parameterized_string.to_s, sep)
+ MonkeySupport::C.inflector_parameterize(parameterized_string.to_s, sep)
else
__parameterize(string, sep)
end
@@ -54,7 +55,7 @@ def parameterize(string, sep = '-')
alias_method :__foreign_key, :foreign_key
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
if is_ascii_string?(class_name)
- ActiveSupport::ASC.inflector_foreign_key(class_name, separate_class_name_and_id_with_underscore)
+ MonkeySupport::C.inflector_foreign_key(class_name, separate_class_name_and_id_with_underscore)
else
__foreign_key(class_name, separate_class_name_and_id_with_underscore)
end
@@ -64,7 +65,7 @@ def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
def ordinalize(number)
x = number.to_i
if is_fixnum?(x)
- ActiveSupport::ASC.inflector_ordinalize(number.to_i)
+ MonkeySupport::C.inflector_ordinalize(x)
else
__ordinalize(number)
end
View
@@ -24,10 +24,6 @@ Gem::Specification.new do |s|
"README.rdoc",
"Rakefile",
"VERSION",
- "ext/Makefile",
- "ext/Makefile",
- "ext/active_support_c.c",
- "ext/active_support_c.c",
"ext/core_ext/string/access.c",
"ext/core_ext/string/access.c",
"ext/core_ext/string/access.h",
@@ -46,6 +42,7 @@ Gem::Specification.new do |s|
"ext/inflector.c",
"ext/inflector.h",
"ext/inflector.h",
+ "ext/monkeysupport_c.c",
"lib/monkeysupport.rb",
"lib/monkeysupport.rb",
"lib/monkeysupport/inflector.rb",

0 comments on commit 6dd699e

Please sign in to comment.