class OodAppkit::Urls::Editor

A class used to handle URLs for the system file Editor app.

Public Class Methods

new(edit_url: '/edit', template: '{/url*}{/fs}{+path}', **kwargs) click to toggle source

@param (see Url#initialize) @param edit_url [#to_s] the URL used to request the file editor api

Calls superclass method OodAppkit::Url::new
# File lib/ood_appkit/urls/editor.rb, line 7
def initialize(edit_url: '/edit', template: '{/url*}{/fs}{+path}', **kwargs)
  super(template: template, **kwargs)
  @edit_url = parse_url_segments(edit_url.to_s)
end

Public Instance Methods

edit(opts = {}) click to toggle source

URL to access this app’s file editor API for a given absolute file path @param opts [#to_h] the available options for this method @option opts [#to_s, nil] :path (“”) The absolute path to the file on

the filesystem

@option opts [#to_s, nil] :fs (“”) The filesystem for the path @return [Addressable::URI] absolute url to access path in file editor

api
# File lib/ood_appkit/urls/editor.rb, line 19
def edit(opts = {})
  opts = opts.to_h.compact.symbolize_keys

  path = opts.fetch(:path, "").to_s
  fs = opts.fetch(:fs, "fs").to_s
  @template.expand url: @base_url + @edit_url, fs: fs, path: path
end