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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/docdsl.rb +9 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  SHA1:
3
3
  metadata.gz: !binary |-
4
- NzIwODk2ZmI1NjY5NTk3MDM0ZTcxN2VlNWZhMTdmYzU1MzcyYmQ5NA==
4
+ MzkxOTc5MTA5MjQ3MjA3ZDU2YjYxNzU3MTcwZTMxOGVjZWE3NGM0ZQ==
5
5
  data.tar.gz: !binary |-
6
- MmI3YzQwZmNmMWRkOWU3MmRjODI2Yjk5ZjBhYTYyNTg5MjdkMTJjNQ==
6
+ OGIzYTJiNDE4ZmRiYTMxNDgxYmMxNDJmMWUzOGVhZGRkOTk0NjBmOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTU2NjQ0MzQyNmNkYjAxYjhmZTRkNzhhNWE0ZGJlOTQ5MmJjY2YyMTFkZGMw
10
- OWMyYmU2ZDVmZDM0M2FiYjIzMjI3NTM0N2RjYmVkYWVkODA4Y2M0MDA4ZjM2
11
- YWExYjgwMjk2YWZiY2Y5ODhhYzZmYWUyNzFmNDZlZWRiYjY5YzU=
9
+ YmFjNTk3MWE3MWRiZWY3ZTU1ODUyNDMyYTUwNjIwMDA2MzJjNmFlZGNjN2Ji
10
+ NzA2ODc1ZWJmY2EyZDI3Yjg0ZWQ0MWZkYTdhNzYwMjliZDY4NWQzZjIyOWFk
11
+ OWUzOGM4MjdkMjE0NjQ0ODA2NGY4YTU0YTE1ODhhZjk3ZGU1OWY=
12
12
  data.tar.gz: !binary |-
13
- NDNmODY0ZjhiMTdiZTU3YzQxZTIwMjQwNjc0OGIxNGYxNmU4MDM4NzJhMDIy
14
- ZjAzODBjMTZjOGRjNGQ0NmQxMzM2NDc1NzUyODBjNWI0ZThjOTEyZGQ1MDI0
15
- NGQzN2ZhNzY0ZmE5MzU0YzUwNzE0ZDZmZTE2ZmIwODY4ZjI4MzE=
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
- # document the method and nullify last_doc so that a new one gets created for the next method
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-docdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jilles van Gurp