reflexive 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ require "reflexive/constantize"
|
|
13
13
|
require "reflexive/descendants"
|
14
14
|
require "reflexive/methods"
|
15
15
|
require "reflexive/method_lookup"
|
16
|
+
require "reflexive/core_ext/reflexive_url"
|
16
17
|
|
17
18
|
if ENV["SINATRA_RELOADER"]
|
18
19
|
require "rails/all"
|
@@ -43,6 +44,10 @@ module Reflexive
|
|
43
44
|
require "pathname"
|
44
45
|
Pathname("../../../").expand_path(__FILE__)
|
45
46
|
end
|
47
|
+
|
48
|
+
def default_url_prefix
|
49
|
+
"http://localhost:3000"
|
50
|
+
end
|
46
51
|
end
|
47
52
|
|
48
53
|
set :public, self.root + "public"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "reflexive/routing_helpers"
|
2
|
+
|
3
|
+
class Method
|
4
|
+
def reflexive_url
|
5
|
+
level = receiver.instance_of?(Class) ? :class : :instance
|
6
|
+
klass = receiver.instance_of?(Class) ? receiver : receiver.class
|
7
|
+
Reflexive::Application.default_url_prefix +
|
8
|
+
Reflexive::RoutingHelpers.new_method_path(klass, level, name)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class UnboundMethod
|
13
|
+
def reflexive_url
|
14
|
+
Reflexive::Application.default_url_prefix +
|
15
|
+
Reflexive::RoutingHelpers.new_method_path(owner, :instance, name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Class
|
20
|
+
def reflexive_url
|
21
|
+
Reflexive::Application.default_url_prefix +
|
22
|
+
Reflexive::RoutingHelpers.constant_path(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Module
|
27
|
+
def reflexive_url
|
28
|
+
Reflexive::Application.default_url_prefix +
|
29
|
+
Reflexive::RoutingHelpers.constant_path(self)
|
30
|
+
end
|
31
|
+
end
|
data/lib/reflexive/methods.rb
CHANGED
@@ -85,12 +85,12 @@ module Reflexive
|
|
85
85
|
ancestors
|
86
86
|
end
|
87
87
|
|
88
|
-
# singleton ancestors
|
88
|
+
# singleton ancestors which ancestor introduced
|
89
89
|
def singleton_ancestors(ancestor)
|
90
90
|
@singleton_ancestors ||= all_singleton_ancestors
|
91
91
|
@singleton_ancestors[ancestor]
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
def all_singleton_ancestors
|
95
95
|
all = {}
|
96
96
|
seen = []
|
@@ -32,6 +32,7 @@ module Reflexive
|
|
32
32
|
def new_method_path(constant, level, method_name)
|
33
33
|
"/reflexive/constants/#{ constant }/#{ level }_methods/#{ CGI.escape(method_name.to_s) }"
|
34
34
|
end
|
35
|
+
module_function :new_method_path
|
35
36
|
|
36
37
|
def method_path(constant, method_name)
|
37
38
|
"/reflexive/constants/#{ constant }/methods/#{ CGI.escape(method_name.to_s) }"
|
@@ -77,6 +78,7 @@ module Reflexive
|
|
77
78
|
def constant_path(constant)
|
78
79
|
"/reflexive/constants/#{ constant }"
|
79
80
|
end
|
81
|
+
module_function :constant_path
|
80
82
|
|
81
83
|
def apidock_path(constant, level, method_name)
|
82
84
|
path = "http://apidock.com/ruby/#{ constant }/#{ CGI.escape(method_name.to_s) }"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Evgeniy Dolzhenko
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-27 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/reflexive/constantize.rb
|
187
187
|
- lib/reflexive/core_ext/kernel/singleton_class.rb
|
188
188
|
- lib/reflexive/core_ext/module/reflexive_instance_methods.rb
|
189
|
+
- lib/reflexive/core_ext/reflexive_url.rb
|
189
190
|
- lib/reflexive/descendants.rb
|
190
191
|
- lib/reflexive/faster_open_struct.rb
|
191
192
|
- lib/reflexive/helpers.rb
|