monkey-lib 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/monkey-lib.rb +14 -1
- data/lib/monkey/autoloader.rb +1 -1
- data/lib/monkey/backend.rb +1 -1
- data/lib/monkey/backend/active_support.rb +1 -4
- data/lib/monkey/ext.rb +6 -3
- data/spec/spec_helper.rb +1 -1
- metadata +4 -4
data/Rakefile
CHANGED
data/lib/monkey-lib.rb
CHANGED
@@ -1,2 +1,15 @@
|
|
1
1
|
require "monkey"
|
2
|
-
|
2
|
+
|
3
|
+
unless defined? Monkey
|
4
|
+
warn "installing both the monkey and the monkey-lib gem results in conflicts, add a Gemfile, use gemsets or remove monkey gem"
|
5
|
+
$LOADED_FEATURES.delete_if { |l| l =~ /monkey\.rb$/ }
|
6
|
+
if defined? require_relative
|
7
|
+
require_relative "monkey"
|
8
|
+
else
|
9
|
+
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
10
|
+
require 'monkey'
|
11
|
+
end
|
12
|
+
fail "Please remove monkey gem (not monkey-lib gem) from your $LOAD_PATH" unless defined? Monkey
|
13
|
+
end
|
14
|
+
|
15
|
+
MonkeyLib = Monkey
|
data/lib/monkey/autoloader.rb
CHANGED
data/lib/monkey/backend.rb
CHANGED
@@ -2,7 +2,7 @@ Monkey::Backend.new :ActiveSupport, :active_support do
|
|
2
2
|
def setup
|
3
3
|
load_lib :version
|
4
4
|
expects_module "::ActiveSupport::CoreExtensions::String::Inflections" if version < "3"
|
5
|
-
load_libs "core_ext/object" => [:
|
5
|
+
load_libs "core_ext/object" => [:singleton_class, :misc], :core_ext => %w[array/extract_options string/inflections module/introspection]
|
6
6
|
if version < "3"
|
7
7
|
::Array.send :include, ::ActiveSupport::CoreExtensions::Array::ExtractOptions
|
8
8
|
::Module.send :include, ::ActiveSupport::CoreExtensions::Module
|
@@ -11,9 +11,6 @@ Monkey::Backend.new :ActiveSupport, :active_support do
|
|
11
11
|
alias to_const_string camelcase
|
12
12
|
alias to_const_path underscore
|
13
13
|
end
|
14
|
-
::Object.class_eval do
|
15
|
-
alias singleton_class metaclass unless respond_to? :singleton_class
|
16
|
-
end
|
17
14
|
end
|
18
15
|
|
19
16
|
def version(default = "0")
|
data/lib/monkey/ext.rb
CHANGED
@@ -17,7 +17,7 @@ module Monkey
|
|
17
17
|
@core_class = klass
|
18
18
|
klass.send :include, self
|
19
19
|
self::ClassMethods.extend ClassDsl
|
20
|
-
self::ClassMethods.core_class core_class
|
20
|
+
self::ClassMethods.core_class @core_class
|
21
21
|
@core_class.class_eval <<-EOS
|
22
22
|
def method_missing(meth, *args, &blk)
|
23
23
|
return super if Monkey::Backend.setup?
|
@@ -26,10 +26,13 @@ module Monkey
|
|
26
26
|
end
|
27
27
|
EOS
|
28
28
|
unless klass.is_a? Class
|
29
|
+
# HACK: Don't modify modules while looping through object space.
|
30
|
+
# JRuby does not like that.
|
31
|
+
list = []
|
29
32
|
ObjectSpace.each_object(Module) do |mod|
|
30
|
-
|
31
|
-
mod.send :include, klass
|
33
|
+
list << mod if mod.ancestors.include? klass and not mod.ancestors.include? self
|
32
34
|
end
|
35
|
+
list.each { |e| e.send :include, klass }
|
33
36
|
end
|
34
37
|
end
|
35
38
|
return @core_class
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Konstantin Haase
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-07-09 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|