Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

edge case for monkeypatch libraries

  • Loading branch information...
commit 6e5265da9edd7f660644b047fceba441fc4ce7b0 1 parent 6877aac
@cldwalker authored
Showing with 9 additions and 3 deletions.
  1. +2 −2 README.rdoc
  2. +1 −1  lib/core/manager.rb
  3. +6 −0 test/manager_test.rb
View
4 README.rdoc
@@ -24,9 +24,9 @@ Patches for more thorough checks are welcome.
== Todo
-* Support file structure where a class's methods are put in a folder with its name ie
+* Config file to save/load your often used extensions
+* Support loading multiple files ie multiple methods under a class directory ie
activesupport/facets-like.
* Make it easier to share (a la sake) and use core extensions made by others.
-* Import/Upgrade old tests for my extension classes.
* Provide aliasing for methods to bypass method name clashes.
* Use Ruby2Ruby to handpick methods to extend.
View
2  lib/core/manager.rb
@@ -32,7 +32,7 @@ def find_or_create_library(lib)
#td: validation
def create_library(lib)
library = lib.is_a?(Hash) ? lib : {:base_class=>lib, :base_path=>Core::Util.class_to_path(lib) }
- libraries[Core::Util.class_to_lib_name(library[:base_class])] = library
+ libraries[Core::Util.class_to_lib_name(library[:base_class] || library[:base_path])] = library
library
end
end
View
6 test/manager_test.rb
@@ -9,6 +9,12 @@ class Core::ManagerTest < Test::Unit::TestCase
Core::Manager.libraries[:funky].should == lib
end
+ test "creates library with a hash but no base_class" do
+ lib = {:base_path=>"funky/ext", :monkeypatch=>true}
+ Core::Manager.create_library(lib)
+ Core::Manager.libraries[:funky].should == lib
+ end
+
test "creates library with base class" do
lib = {:base_class=>::Base, :base_path=>"base"}
Core::Manager.create_library(::Base)
Please sign in to comment.
Something went wrong with that request. Please try again.