Sha256: 20f2190e30e4e5c172061b8144aa4f879e5159a0e264bd3a8319fa64c505c3b8

Contents?: true

Size: 779 Bytes

Versions: 10

Compression:

Stored size: 779 Bytes

Contents

module OodAppkit
  module Urls
    # A class used to handle URLs for the system file Editor app.
    class Editor < Url
      # @param (see Url#initialize)
      # @param edit_url [#to_s] the URL used to request the file editor api
      def initialize(edit_url: '/edit', template: '{/url*}{+path}', **kwargs)
        super(template: template, **kwargs)
        @edit_url = parse_url_segments(edit_url.to_s)
      end

      # URL to access this app's file editor API for a given absolute file path
      # @param path [#to_s] the absolute path to the file on the filesystem
      # @return [Addressable::URI] absolute url to access path in file editor api
      def edit(path: '')
        @template.expand url: @base_url + @edit_url, 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/editor.rb
ood_appkit-0.3.6 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.5 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.4 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.3 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.2 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.1 lib/ood_appkit/urls/editor.rb
ood_appkit-0.3.0 lib/ood_appkit/urls/editor.rb
ood_appkit-0.2.8 lib/ood_appkit/urls/editor.rb
ood_appkit-0.2.7 lib/ood_appkit/urls/editor.rb