rdropbox 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ class Module # :nodoc:
2
+ def alias_method_chain(target, feature) # :nodoc:
3
+ # Strip out punctuation on predicates or bang methods since
4
+ # e.g. target?_without_feature is not a valid method name.
5
+ aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
6
+ yield(aliased_target, punctuation) if block_given?
7
+
8
+ with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
9
+
10
+ alias_method without_method, target
11
+ alias_method target, with_method
12
+
13
+ case
14
+ when public_method_defined?(without_method)
15
+ public target
16
+ when protected_method_defined?(without_method)
17
+ protected target
18
+ when private_method_defined?(without_method)
19
+ private target
20
+ end
21
+ end unless method_defined?(:alias_method_chain)
22
+ end
@@ -0,0 +1,5 @@
1
+ class Object # :nodoc:
2
+ def eigenclass # :nodoc:
3
+ (class << self; self; end)
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class String # :nodoc:
2
+ def starts_with?(prefix) # :nodoc:
3
+ self[0, prefix.length] == prefix
4
+ end unless method_defined?(:starts_with?)
5
+
6
+ def ends_with?(suffix) # :nodoc:
7
+ self[-suffix.length, suffix.length] == suffix
8
+ end unless method_defined?(:ends_with?)
9
+ end
@@ -0,0 +1,17 @@
1
+ class Object # :nodoc:
2
+ def to_bool # :nodoc:
3
+ true
4
+ end
5
+ end
6
+
7
+ class FalseClass # :nodoc:
8
+ def to_bool # :nodoc:
9
+ false
10
+ end
11
+ end
12
+
13
+ class NilClass # :nodoc:
14
+ def to_bool # :nodoc:
15
+ false
16
+ end
17
+ end