rdropbox 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/LICENSE +20 -0
- data/README.rdoc +84 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/dropbox.gemspec +87 -0
- data/lib/dropbox/api.rb +530 -0
- data/lib/dropbox/entry.rb +96 -0
- data/lib/dropbox/event.rb +109 -0
- data/lib/dropbox/memoization.rb +98 -0
- data/lib/dropbox/revision.rb +197 -0
- data/lib/dropbox/session.rb +160 -0
- data/lib/dropbox.rb +43 -0
- data/lib/extensions/array.rb +9 -0
- data/lib/extensions/hash.rb +61 -0
- data/lib/extensions/module.rb +22 -0
- data/lib/extensions/object.rb +5 -0
- data/lib/extensions/string.rb +9 -0
- data/lib/extensions/to_bool.rb +17 -0
- data/spec/dropbox/api_spec.rb +778 -0
- data/spec/dropbox/entry_spec.rb +144 -0
- data/spec/dropbox/event_spec.rb +122 -0
- data/spec/dropbox/revision_spec.rb +367 -0
- data/spec/dropbox/session_spec.rb +148 -0
- data/spec/dropbox_spec.rb +57 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- metadata +150 -0
@@ -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,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
|