Class: OodAppkit::Urls::Shell

Inherits:
OodAppkit::Url show all
Defined in:
lib/ood_appkit/urls/shell.rb

Overview

A class used to handle URLs for the system Shell app.

Instance Attribute Summary

Attributes inherited from OodAppkit::Url

#title

Instance Method Summary collapse

Constructor Details

#initialize(ssh_url: '/ssh', template: '{/url*}/{host}{+path}', **kwargs) ⇒ Shell

Returns a new instance of Shell.

Parameters:

  • ssh_url (#to_s) (defaults to: '/ssh')

    the ssh URL used to access the terminal

  • title (#to_s)

    the title of the URL

  • base_url (#to_s)

    the base URL used to access this app

  • template (#to_s) (defaults to: '{/url*}/{host}{+path}')

    the template used to generate URLs for this app



7
8
9
10
# File 'lib/ood_appkit/urls/shell.rb', line 7

def initialize(ssh_url: '/ssh', template: '{/url*}/{host}{+path}', **kwargs)
  super(template: template, **kwargs)
  @ssh_url = parse_url_segments(ssh_url.to_s)
end

Instance Method Details

#url(host: 'default', path: '') ⇒ Addressable::URI

URL to access this app for a given host and absolute file path

Parameters:

  • host (#to_s) (defaults to: 'default')

    the host the app will make an ssh connection with

  • path (#to_s) (defaults to: '')

    the absolute path to the directory ssh app opens up in

Returns:

  • (Addressable::URI)

    the url used to access the app



16
17
18
# File 'lib/ood_appkit/urls/shell.rb', line 16

def url(host: 'default', path: '')
  @template.expand url: @base_url + @ssh_url, host: host.to_s, path: path.to_s
end