Class: Chaplin::Parser::Redirects

Inherits:
Struct
  • Object
show all
Defined in:
lib/chaplin/parser/redirects.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#redirect_declarationsObject

Returns the value of attribute redirect_declarations

Returns:

  • (Object)

    the current value of redirect_declarations



7
8
9
# File 'lib/chaplin/parser/redirects.rb', line 7

def redirect_declarations
  @redirect_declarations
end

Class Method Details

.load(redirect_declarations) ⇒ Object



9
10
11
# File 'lib/chaplin/parser/redirects.rb', line 9

def self.load(redirect_declarations)
  new(redirect_declarations).load
end

Instance Method Details

#loadObject



13
14
15
16
17
# File 'lib/chaplin/parser/redirects.rb', line 13

def load
  redirect_declarations.each_with_object({}) do |(redirect_name, redirect_data), redirects_hash|
    redirects_hash[redirect_name.to_s] = Responses::Redirect.new(redirect_data['path'], api_requests(redirect_data['requests']))
  end
end