Module: Inferno::DSL::Links
- Included in:
- Entities::TestSuite
- Defined in:
- lib/inferno/dsl/links.rb
Overview
This module contains methods to add test suite links which are displayed in the footer of the UI
Constant Summary collapse
- DEFAULT_TYPES =
{ 'report_issue' => 'Report Issue', 'source_code' => 'Open Source', 'download' => 'Download', 'ig' => 'Implementation Guide' }.freeze
Instance Method Summary collapse
-
#add_link(type, label, url) ⇒ Array<Hash>
Add a link to the test suit links list.
- #add_predefined_link(type, url, label = nil) ⇒ Object
-
#download_url(url, label: nil) ⇒ Array<Hash>
Add a link to the latest release version of the test kit.
-
#ig_url(url, label: nil) ⇒ Array<Hash>
Add a link to the implementation guide.
-
#links(links = nil) ⇒ Array<Hash>
Set/get a list of links which are displayed in the footer of the UI.
-
#report_issue_url(url, label: nil) ⇒ Array<Hash>
Add a link to report an issue in the footer of the UI.
-
#source_code_url(url, label: nil) ⇒ Array<Hash>
Add a link to the source code repository.
Instance Method Details
#add_link(type, label, url) ⇒ Array<Hash>
Add a link to the test suit links list.
51 52 53 |
# File 'lib/inferno/dsl/links.rb', line 51 def add_link(type, label, url) links << { type:, label:, url: } end |
#add_predefined_link(type, url, label = nil) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/inferno/dsl/links.rb', line 92 def add_predefined_link(type, url, label = nil) label ||= DEFAULT_TYPES[type] raise ArgumentError, "Invalid link type: #{type}" unless label add_link(type, label, url) end |
#download_url(url, label: nil) ⇒ Array<Hash>
Add a link to the latest release version of the test kit.
78 79 80 |
# File 'lib/inferno/dsl/links.rb', line 78 def download_url(url, label: nil) add_predefined_link('download', url, label) end |
#ig_url(url, label: nil) ⇒ Array<Hash>
Add a link to the implementation guide.
69 70 71 |
# File 'lib/inferno/dsl/links.rb', line 69 def ig_url(url, label: nil) add_predefined_link('ig', url, label) end |
#links(links = nil) ⇒ Array<Hash>
Set/get a list of links which are displayed in the footer of the UI.
33 34 35 36 37 38 |
# File 'lib/inferno/dsl/links.rb', line 33 def links(links = nil) @links ||= [] return @links if links.nil? @links.concat(links) end |
#report_issue_url(url, label: nil) ⇒ Array<Hash>
Add a link to report an issue in the footer of the UI.
87 88 89 |
# File 'lib/inferno/dsl/links.rb', line 87 def report_issue_url(url, label: nil) add_predefined_link('report_issue', url, label) end |
#source_code_url(url, label: nil) ⇒ Array<Hash>
Add a link to the source code repository.
60 61 62 |
# File 'lib/inferno/dsl/links.rb', line 60 def source_code_url(url, label: nil) add_predefined_link('source_code', url, label) end |