rspec-api-docs 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a857b455227b03c4d95835fd82d250be2cc4435b
4
- data.tar.gz: 85108372a0fd8bdd440ad098959cadd4acc979ce
3
+ metadata.gz: 366d34d11131e28d3d3c88024ae9ffce5d2d2f27
4
+ data.tar.gz: 6a143737560c1d8ac8630a35761da4ac45e1efab
5
5
  SHA512:
6
- metadata.gz: 6ecce2a07476e855f8b5f483818f672bda0af1d535f6f99f07c550db6dfa097e29b0122da85fd32e6097add999d1a10e96ef2524f0dca0b5d0cc533a9eba4eb8
7
- data.tar.gz: d139049350af5da882800943f9078735bc49ccd90df096244b04dc766820c2e481afda8ac76d7a33b7d70c5730b82632f7e4a7f9826d21b9b5c7a13d01b9fa59
6
+ metadata.gz: c144b0cb4b2e0684c141fa92fe5edba7492e2dcd8e28adfd7f02ce530326848efb0cb3179753d8e36e529b03af53742ebf2fec77cf36345d00ba3bb328ff8f82
7
+ data.tar.gz: 7eb7c7a1b0283bfacecde7db7069c116809e0adf6a1a48969549281716e370d4fd24bcff1898717124fdf03d319ce0b904c6fa7a0aecf24ab99a887fa500d109
@@ -33,14 +33,14 @@ module RspecApiDocs
33
33
  return unless rspec_example.metadata[METADATA_NAMESPACE]
34
34
  resource = Resource.new(rspec_example)
35
35
  resources[resource.name] ||= resource
36
- resources[resource.name].examples << Resource::Example.new(rspec_example)
36
+ resources[resource.name].add_example Resource::Example.new(rspec_example)
37
37
  end
38
38
 
39
39
  # Calls the configured renderer with the stored {Resource}s.
40
40
  #
41
41
  # @return [void]
42
42
  def close(null_notification)
43
- renderer.new(resources.values).render
43
+ renderer.new(resources.values.sort_by(&:name)).render
44
44
  end
45
45
 
46
46
  private
@@ -6,11 +6,6 @@ module RspecApiDocs
6
6
  class Resource
7
7
  attr_reader :rspec_example
8
8
 
9
- # Returns an array of {Example}s
10
- #
11
- # @return [Array<Example>]
12
- attr_accessor :examples
13
-
14
9
  def initialize(rspec_example)
15
10
  @rspec_example = rspec_example
16
11
  @examples = []
@@ -34,6 +29,20 @@ module RspecApiDocs
34
29
  metadata[:resource_description]
35
30
  end
36
31
 
32
+ # Returns an array of {Example}s
33
+ #
34
+ # @return [Array<Example>]
35
+ def examples
36
+ @examples.sort_by(&:name)
37
+ end
38
+
39
+ # Add an example
40
+ #
41
+ # @return [void]
42
+ def add_example(example)
43
+ @examples << example
44
+ end
45
+
37
46
  private
38
47
 
39
48
  def metadata
@@ -1,3 +1,3 @@
1
1
  module RspecApiDocs
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-api-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Odin Dutton
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.5.1
178
+ rubygems_version: 2.5.2
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Generate API documentation using RSpec