Sha256: 9514e26d0fa9f73c84ee77f90e10d41c8a8838734d7c5ad010485b3ea10eb857

Contents?: true

Size: 417 Bytes

Versions: 15

Compression:

Stored size: 417 Bytes

Contents

module RspecApiDocs
  module Renderer
    class JSONRenderer
      class Name
        def self.call(name:, scope:)
          scope = Array(scope)
          if scope.empty?
            name
          else
            scope.each_with_index.inject('') do |str, (part, index)|
              str << (index == 0 ? part : "[#{part}]").to_s
            end + "[#{name}]"
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rspec-api-docs-1.1.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-1.0.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.14.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.13.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.12.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.11.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.10.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.9.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.8.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.7.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.6.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.5.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.4.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.3.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb
rspec-api-docs-0.2.0 lib/rspec_api_docs/formatter/renderer/json_renderer/name.rb