Class: Prmd::UrlGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/prmd/url_generator.rb,
lib/prmd/url_generators/generators/json.rb,
lib/prmd/url_generators/generators/default.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Generators

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ UrlGenerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of UrlGenerator.

Parameters:

  • params (Hash<Symbol, Object>)


10
11
12
13
14
# File 'lib/prmd/url_generator.rb', line 10

def initialize(params)
  @schema = params[:schema]
  @link = params[:link]
  @options = params.fetch(:options)
end

Instance Method Details

#url_paramsArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array)


17
18
19
20
21
22
23
24
25
# File 'lib/prmd/url_generator.rb', line 17

def url_params
  if @options[:doc][:url_style].downcase == 'json'
    klass = Generators::JSON
  else
    klass = Generators::Default
  end

  klass.generate(schema: @schema, link: @link)
end