Class: LD::Patch::Format
- Inherits:
-
RDF::Format
- Object
- RDF::Format
- LD::Patch::Format
- Defined in:
- lib/ld/patch/format.rb
Overview
LD::Patch format specification. Note that this format does not define any readers or writers.
Class Method Summary collapse
-
.cli_commands ⇒ Hash{Symbol => Lambda(Array, Hash)}
Hash of CLI commands appropriate for this format.
- .to_sym ⇒ Object
Class Method Details
.cli_commands ⇒ Hash{Symbol => Lambda(Array, Hash)}
Hash of CLI commands appropriate for this format
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ld/patch/format.rb', line 20 def self.cli_commands { patch: { description: "Patch the current graph using a URI Encoded patch file, or a referenced path file/URI", help: "patch [--patch 'patch'] [--patch-file file]", parse: true, lambda: -> (argv, opts) do opts[:patch] ||= RDF::Util::File.open_file(opts[:patch_file]) {|f| f.read} raise ArgumentError, "Patching requires a URI encoded patch or reference to patch resource" unless opts[:patch] $stdout.puts "Patch" patch = LD::Patch.parse(opts[:patch], base_uri: opts.fetch(:patch_file, "http://rubygems.org/gems/ld-patch")) RDF::CLI.repository.query(patch) end, options: [ RDF::CLI::Option.new( symbol: :patch, datatype: String, on: ["--patch STRING"], description: "Patch in URI encoded format" ) {|v| URI.decode(v)}, RDF::CLI::Option.new( symbol: :patch_file, datatype: String, on: ["--patch-file URI"], description: "URI of patch file" ) {|v| RDF::URI(v)}, ] } } end |
.to_sym ⇒ Object
51 |
# File 'lib/ld/patch/format.rb', line 51 def self.to_sym; :ldpatch; end |