whats_up 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Gemfile +1 -1
- data/Rakefile +3 -0
- data/lib/whats_up/classic.rb +4 -0
- data/lib/whats_up/method_finder.rb +5 -6
- data/lib/whats_up/methods.rb +14 -0
- data/lib/whats_up/version.rb +1 -1
- data/spec/classic_spec.rb +0 -2
- data/spec/frozen_section_spec.rb +0 -2
- data/spec/method_finder_spec.rb +13 -0
- data/spec/methods_spec.rb +0 -2
- metadata +4 -2
data/.rspec
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/whats_up/classic.rb
CHANGED
@@ -3,16 +3,15 @@ module WhatsUp
|
|
3
3
|
# values with an expected result. ny matches will then be pretty printed to the console.
|
4
4
|
class MethodFinder
|
5
5
|
# A list of symbols indicated which methods to always ignore
|
6
|
-
@@blacklist
|
7
|
-
|
8
|
-
|
9
|
-
whats_exactly whats_not_blank whats_not_blank_with works?).map(&:to_sym)
|
6
|
+
@@blacklist = %w(daemonize debug debugger display ed emacs exec exit! fork mate nano sleep
|
7
|
+
stub stub! stub_chain syscall system unstub unstub! vi vim).map(&:to_sym)
|
8
|
+
@@blacklist += Methods.instance_methods
|
10
9
|
|
11
10
|
# A list of symbols for infix operators for which Ruby has special syntax
|
12
|
-
@@infixes
|
11
|
+
@@infixes = %w(+ - * / % ** == != =~ !~ !=~ > < >= <= <=> === & | ^ << >>).map(&:to_sym)
|
13
12
|
|
14
13
|
# A list of symbols for prefix operators for which Ruby has special syntax
|
15
|
-
@@prefixes
|
14
|
+
@@prefixes = %w(+@ -@ ~ !).map(&:to_sym)
|
16
15
|
|
17
16
|
class << self
|
18
17
|
# Builds a lambda for checking against the provided +expected_result+ given a hash of options.
|
data/lib/whats_up/methods.rb
CHANGED
@@ -44,6 +44,20 @@ module WhatsUp
|
|
44
44
|
end
|
45
45
|
alias :whats_not_blank :whats_not_blank_with
|
46
46
|
|
47
|
+
# The list of all methods unique to an object
|
48
|
+
def unique_methods
|
49
|
+
methods - self.class.methods
|
50
|
+
end
|
51
|
+
|
52
|
+
# Lists all methods available to the object by ancestor
|
53
|
+
def methods_by_ancestor
|
54
|
+
result = {}
|
55
|
+
([self] + self.class.ancestors).each do |object|
|
56
|
+
result[object] = object.unique_methods
|
57
|
+
end
|
58
|
+
result
|
59
|
+
end
|
60
|
+
|
47
61
|
# Make sure cloning doesn't cause anything to fail via type errors
|
48
62
|
alias_method :__clone__, :clone
|
49
63
|
|
data/lib/whats_up/version.rb
CHANGED
data/spec/classic_spec.rb
CHANGED
data/spec/frozen_section_spec.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
describe MethodFinder do
|
2
|
+
describe "blacklist" do
|
3
|
+
it "should contain classic methods" do
|
4
|
+
MethodFinder.class_variable_get(:@@blacklist).should include(:what?)
|
5
|
+
MethodFinder.class_variable_get(:@@blacklist).should include(:works?)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should contain newer methods" do
|
9
|
+
MethodFinder.class_variable_get(:@@blacklist).should include(:what_equals)
|
10
|
+
MethodFinder.class_variable_get(:@@blacklist).should include(:what_works)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/methods_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whats_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sdoc
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/whats_up/version.rb
|
133
133
|
- spec/classic_spec.rb
|
134
134
|
- spec/frozen_section_spec.rb
|
135
|
+
- spec/method_finder_spec.rb
|
135
136
|
- spec/methods_spec.rb
|
136
137
|
- spec/spec_helper.rb
|
137
138
|
- whats_up.gemspec
|
@@ -162,5 +163,6 @@ summary: Determine what methods can be called on an object that return a given v
|
|
162
163
|
test_files:
|
163
164
|
- spec/classic_spec.rb
|
164
165
|
- spec/frozen_section_spec.rb
|
166
|
+
- spec/method_finder_spec.rb
|
165
167
|
- spec/methods_spec.rb
|
166
168
|
- spec/spec_helper.rb
|