reflexive 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/reflexive/application.rb +171 -0
- data/lib/reflexive/coderay_html_encoder.rb +46 -0
- data/lib/reflexive/coderay_ruby_scanner.rb +234 -0
- data/lib/reflexive/columnizer.rb +73 -0
- data/lib/reflexive/constantize.rb +71 -0
- data/lib/reflexive/descendants.rb +39 -0
- data/lib/reflexive/faster_open_struct.rb +116 -0
- data/lib/reflexive/helpers.rb +189 -0
- data/lib/reflexive/methods.rb +140 -0
- data/lib/reflexive/parse_tree_top_down_walker.rb +392 -0
- data/lib/reflexive/reflexive_ripper.rb +274 -0
- data/lib/reflexive/routing_helpers.rb +70 -0
- data/lib/reflexive/variables_scope.rb +16 -0
- data/lib/reflexive.rb +1 -0
- data/public/javascripts/reflexive/jquery-1.4.2.js +6240 -0
- data/public/javascripts/reflexive/reflexive.js +12 -0
- data/public/stylesheets/reflexive/coderay.css +130 -0
- data/public/stylesheets/reflexive/reflexive.css +111 -0
- data/reflexive.gemspec +25 -0
- data/views/constants_methods.html.erb +0 -0
- data/views/constants_show.erb +96 -0
- data/views/dashboard.erb +50 -0
- data/views/directories_show.erb +16 -0
- data/views/error.erb +5 -0
- data/views/files_show.erb +27 -0
- data/views/layout.erb +20 -0
- data/views/methods_apidock.erb +17 -0
- data/views/methods_definition.erb +37 -0
- data/views/methods_rubydoc.erb +16 -0
- metadata +231 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
require "cgi" unless defined?(CGI) && defined?(CGI::escape)
|
2
|
+
|
3
|
+
module RoutingHelpers
|
4
|
+
# method_call_tag is the scanner event tag emitted by ReflexiveRipper
|
5
|
+
def method_call_path(method_call_tag)
|
6
|
+
# r method_call_tag.values_at(:name, :receiver)
|
7
|
+
name, receiver = method_call_tag.values_at(:name, :receiver)
|
8
|
+
if receiver.last == :instance
|
9
|
+
new_method_path(receiver[0..-2].join("::"), :instance, name)
|
10
|
+
else
|
11
|
+
new_method_path(receiver.join("::"), :class, name)
|
12
|
+
end rescue(r(method_call_tag))
|
13
|
+
end
|
14
|
+
|
15
|
+
# entry point for method links (may dispatch to
|
16
|
+
# class_method_definition_path or method_documentation_path based on whether
|
17
|
+
# the method definition was found by with our reflection capabilities)
|
18
|
+
def new_method_path(constant, level, method_name)
|
19
|
+
"/reflexive/constants/#{ constant }/#{ level }_methods/#{ CGI.escape(method_name.to_s) }"
|
20
|
+
end
|
21
|
+
|
22
|
+
def class_method_definition_path(constant, method_name)
|
23
|
+
new_method_path(constant, :class, method_name) + "/definition"
|
24
|
+
end
|
25
|
+
|
26
|
+
def instance_method_definition_path(constant, method_name)
|
27
|
+
new_method_path(constant, :instance, method_name) + "/definition"
|
28
|
+
end
|
29
|
+
|
30
|
+
def method_documentation_path(constant, method_name)
|
31
|
+
method_path(constant, method_name) + "/apidock"
|
32
|
+
end
|
33
|
+
|
34
|
+
def dashboard_path
|
35
|
+
"/reflexive/dashboard"
|
36
|
+
end
|
37
|
+
|
38
|
+
def up_path(path)
|
39
|
+
file_path(File.expand_path("../", path))
|
40
|
+
end
|
41
|
+
|
42
|
+
def file_path(path)
|
43
|
+
File.join("/reflexive/files", path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def constant_lookup_path(name, scope)
|
47
|
+
"/reflexive/constant_lookup" <<
|
48
|
+
"?name=#{ CGI.escape(name) }&scope=#{ CGI.escape(scope.join("::"))}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def load_path_lookup_path(path)
|
52
|
+
"/reflexive/load_path_lookup?path=#{ CGI.escape(path.to_s) }"
|
53
|
+
end
|
54
|
+
|
55
|
+
def constant_path(constant)
|
56
|
+
"/reflexive/constants/#{ constant }"
|
57
|
+
end
|
58
|
+
|
59
|
+
def method_path(constant, method_name)
|
60
|
+
"/reflexive/constants/#{ constant }/methods/#{ CGI.escape(method_name.to_s) }"
|
61
|
+
end
|
62
|
+
|
63
|
+
def apidock_path(constant, method_name)
|
64
|
+
"http://apidock.com/ruby/#{ constant }/#{ CGI.escape(method_name.to_s) }"
|
65
|
+
end
|
66
|
+
|
67
|
+
def method_definition_path(constant, method_name)
|
68
|
+
method_path(constant, method_name) + "/definition"
|
69
|
+
end
|
70
|
+
end
|
data/lib/reflexive.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "reflexive/application"
|