Skip to content

Commit 6115b72

Browse files
committed
Reader and Writer options.
1 parent efee0b8 commit 6115b72

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

lib/rdf/rdfxml/reader.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ def inspect
131131
# the prefix mappings to use (not supported by all readers)
132132
# @option options [#to_s] :base_uri (nil)
133133
# the base URI to use when resolving relative URIs
134-
# @option options [Array] :debug
135-
# Array to place debug messages
136134
# @return [reader]
137135
# @yield [reader] `self`
138136
# @yieldparam [RDF::Reader] reader

lib/rdf/rdfxml/writer.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@ class Writer < RDF::RDFa::Writer
5353

5454
VALID_ATTRIBUTES = [:none, :untyped, :typed]
5555

56+
##
57+
# RDF/XML Writer options
58+
# @see http://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Writer#options-class_method
59+
def self.options
60+
super + [
61+
RDF::CLI::Option.new(
62+
symbol: :attributes,
63+
datatype: %w(none untyped typed),
64+
on: ["--attributes ATTRIBUTES", %w(none untyped typed)],
65+
description: "How to use XML attributes when serializing, one of :none, :untyped, :typed. The default is :none.") {|arg| arg.to_sym},
66+
RDF::CLI::Option.new(
67+
symbol: :default_namespace,
68+
datatype: RDF::URI,
69+
on: ["--default-namespace URI", :REQUIRED],
70+
description: "URI to use as default namespace, same as prefixes.") {|arg| RDF::URI(arg)},
71+
RDF::CLI::Option.new(
72+
symbol: :lang,
73+
datatype: String,
74+
on: ["--lang"],
75+
description: "Output as root @lang attribute, and avoid generation _@lang_ where possible."),
76+
RDF::CLI::Option.new(
77+
symbol: :max_depth,
78+
datatype: Integer,
79+
on: ["--max-depth"],
80+
description: "Maximum depth for recursively defining resources, defaults to 3.") {|arg| arg.to_i},
81+
RDF::CLI::Option.new(
82+
symbol: :stylesheet,
83+
datatype: RDF::URI,
84+
on: ["--stylesheet URI", :REQUIRED],
85+
description: "URI to use as @href for output stylesheet processing instruction.") {|arg| RDF::URI(arg)},
86+
]
87+
end
88+
5689
##
5790
# Initializes the RDF/XML writer instance.
5891
#

0 commit comments

Comments
 (0)