Sha256: e41d421bdd35fd9c48933fb9d6507b37e0fa302e8b889701625d21cedbd0ee63

Contents?: true

Size: 862 Bytes

Versions: 10

Compression:

Stored size: 862 Bytes

Contents

module OodAppkit
  module Urls
    # A class used to handle URLs for the system Shell app.
    class Shell < Url
      # @param (see Url#initialize)
      # @param ssh_url [#to_s] the ssh URL used to access the terminal
      def initialize(ssh_url: '/ssh', template: '{/url*}/{host}{+path}', **kwargs)
        super(template: template, **kwargs)
        @ssh_url = parse_url_segments(ssh_url.to_s)
      end

      # URL to access this app for a given host and absolute file path
      # @param host [#to_s] the host the app will make an ssh connection with
      # @param path [#to_s] the absolute path to the directory ssh app opens up in
      # @return [Addressable::URI] the url used to access the app
      def url(host: 'default', path: '')
        @template.expand url: @base_url + @ssh_url, host: host.to_s, path: path.to_s
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ood_appkit-1.0.0 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.6 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.5 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.4 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.3 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.2 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.1 lib/ood_appkit/urls/shell.rb
ood_appkit-0.3.0 lib/ood_appkit/urls/shell.rb
ood_appkit-0.2.8 lib/ood_appkit/urls/shell.rb
ood_appkit-0.2.7 lib/ood_appkit/urls/shell.rb