autodoc 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f28352ff24e3c6fdf3a216edefe9bab4ea47ab7
4
- data.tar.gz: ac44963e5b1ade2bad547e9ac9d8cc50beb84a30
3
+ metadata.gz: f65c49b9848c73ca1b541e127c4ddf0e88398204
4
+ data.tar.gz: c96d43d4d997c3dd77ee24e1f2dac07f21950545
5
5
  SHA512:
6
- metadata.gz: 9e9f5fa9018542f1077182d0915f0e68ad25bcf952d6a32e517d5b355ff385e75a287596e700483703eaf55117e81002eb9fb30db64babe2200cb5ef5bbae1eb
7
- data.tar.gz: 467e4ae8db8f3facfb2bfae62e16dc3336d6e09c5abd5c47d8339bcfe0b7095f2d46c2bd80a366e8d65b36e68125ea41e9f5d957ff10ff8df5bc08ebd003289d
6
+ metadata.gz: db3256827ba11fac42e63b14a5795477761f87da901c3d7dbe27c09d3e01a428b33592de932767d1b112420cd408bf053576247909979f32661b6a4a1774b493
7
+ data.tar.gz: 578d459c2bb55482e42c8a7f4fc368484e1536aa8bf10616c385c81fe8645c0c4e44628d7b32026f262d64987ecb6b74fb0bd349c682bc04e15977b4eaf684e0
@@ -1,10 +1,17 @@
1
1
  require "autodoc/collector"
2
+ require "autodoc/configuration"
2
3
  require "autodoc/document"
3
4
  require "autodoc/version"
4
5
 
5
6
  module Autodoc
6
- def self.collector
7
- @collector ||= Autodoc::Collector.new
7
+ class << self
8
+ def collector
9
+ @collector ||= Autodoc::Collector.new
10
+ end
11
+
12
+ def configuration
13
+ @configuration ||= Autodoc::Configuration.new
14
+ end
8
15
  end
9
16
  end
10
17
 
@@ -0,0 +1,20 @@
1
+ # You can configure documented headers.
2
+ #
3
+ # Examples
4
+ #
5
+ # # response.headers["X-Content-Type-Options"] will be documented.
6
+ # Autodoc.configuration.headers << "X-Content-Type-Options"
7
+ #
8
+ module Autodoc
9
+ class Configuration
10
+ attr_accessor :headers
11
+
12
+ def initialize
13
+ reset
14
+ end
15
+
16
+ def reset
17
+ @headers = %w[Link location]
18
+ end
19
+ end
20
+ end
@@ -53,12 +53,10 @@ module Autodoc
53
53
  WeakParameters.stats[request.params[:controller]][request.params[:action]].try(:validators)
54
54
  end
55
55
 
56
- def link
57
- "\nLink: #{response.header['Link']}" if response.header["Link"]
58
- end
59
-
60
- def location
61
- "\nlocation: #{response.location}" if response.location
56
+ def headers
57
+ Autodoc.configuration.headers.map do |header|
58
+ "\n#{header}: #{response.headers[header]}" if response.headers[header]
59
+ end.compact.join
62
60
  end
63
61
  end
64
62
  end
@@ -73,7 +71,7 @@ __END__
73
71
  <%= parameters_section %>
74
72
  ### response
75
73
  ```
76
- Status: <%= response.status %><%= link %><%= location %>
74
+ Status: <%= response.status %><%= headers %>
77
75
  response: <%= request_body %>
78
76
  ```
79
77
 
@@ -1,3 +1,3 @@
1
1
  module Autodoc
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-10 00:00:00.000000000 Z
11
+ date: 2013-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -109,6 +109,7 @@ files:
109
109
  - autodoc.gemspec
110
110
  - lib/autodoc.rb
111
111
  - lib/autodoc/collector.rb
112
+ - lib/autodoc/configuration.rb
112
113
  - lib/autodoc/document.rb
113
114
  - lib/autodoc/version.rb
114
115
  - spec/dummy/Rakefile