sinatra-docdsl 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/docdsl.rb +9 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzkxOTc5MTA5MjQ3MjA3ZDU2YjYxNzU3MTcwZTMxOGVjZWE3NGM0ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGIzYTJiNDE4ZmRiYTMxNDgxYmMxNDJmMWUzOGVhZGRkOTk0NjBmOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmFjNTk3MWE3MWRiZWY3ZTU1ODUyNDMyYTUwNjIwMDA2MzJjNmFlZGNjN2Ji
|
10
|
+
NzA2ODc1ZWJmY2EyZDI3Yjg0ZWQ0MWZkYTdhNzYwMjliZDY4NWQzZjIyOWFk
|
11
|
+
OWUzOGM4MjdkMjE0NjQ0ODA2NGY4YTU0YTE1ODhhZjk3ZGU1OWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGZmYjc0NTJlZDEyNjJiNzQxYjlmZmMyY2M3MDlmNjI4ZTljMTdlYmRiZTIz
|
14
|
+
NGJhZWEyOWM4MGVjNzFiNjgyMWIzZTIyMTM3OWM0Mzc1ZmJjNDA4NGUxZmZk
|
15
|
+
MmVkNDJiM2U1NWNhMThkNWZjNGM5ODI4ODk1MzEzMDhmMjI0Zjg=
|
data/lib/docdsl.rb
CHANGED
@@ -4,11 +4,12 @@ require 'kramdown'
|
|
4
4
|
module Sinatra
|
5
5
|
module DocDsl
|
6
6
|
class PageDoc
|
7
|
-
attr_accessor :the_title,:the_header,:the_footer,:the_introduction,:entries
|
7
|
+
attr_accessor :the_title,:the_header,:the_footer,:the_introduction,:entries,:the_url_prefix
|
8
8
|
|
9
9
|
def initialize(&block)
|
10
10
|
@the_title='DocDSL Documentation'
|
11
11
|
@the_header="API"
|
12
|
+
@the_url_prefix=""
|
12
13
|
@the_introduction="API Documentation for this resource"
|
13
14
|
@the_footer='Powered by <strong><a href="https://github.com/jillesvangurp/sinatra-docdsl">Sinatra DocDSL</a></strong>'
|
14
15
|
configure_renderer do
|
@@ -48,6 +49,10 @@ module Sinatra
|
|
48
49
|
@render_function.call
|
49
50
|
end
|
50
51
|
|
52
|
+
def url_prefix(prefix)
|
53
|
+
@the_url_prefix=prefix
|
54
|
+
end
|
55
|
+
|
51
56
|
def json
|
52
57
|
entries=[]
|
53
58
|
@entries.each do |entry|
|
@@ -303,10 +308,6 @@ HTML
|
|
303
308
|
self.inspect
|
304
309
|
end
|
305
310
|
|
306
|
-
def inspect
|
307
|
-
"#{@paths.join(', ')} # #{@desc}"
|
308
|
-
end
|
309
|
-
|
310
311
|
def describe(desc)
|
311
312
|
@desc=desc
|
312
313
|
end
|
@@ -423,9 +424,10 @@ HTML
|
|
423
424
|
end
|
424
425
|
|
425
426
|
def method_added(method)
|
426
|
-
#
|
427
|
+
# gets called everytime a method is added to the app.
|
428
|
+
# only triggers if the previous method was a documentation ... call
|
427
429
|
if @last_doc
|
428
|
-
@last_doc << method
|
430
|
+
@last_doc << method.to_s.sub(' ', " #{@page_doc.the_url_prefix}")
|
429
431
|
@last_doc = nil
|
430
432
|
end
|
431
433
|
super
|