Class: Saxon::Serializer::OutputProperties
- Inherits:
-
Object
- Object
- Saxon::Serializer::OutputProperties
- Defined in:
- lib/saxon/serializer.rb
Overview
Manage access to the serialization properties of this serializer, with hash-like access.
Properties can be set explicitly through this API, or via XSLT or XQuery serialization options like ‘<xsl:output>`.
Properties set explicitly here will override properties set through the document like ‘<xsl:output>`.
Instance Attribute Summary collapse
-
#s9_serializer ⇒ Object
readonly
Returns the value of attribute s9_serializer.
Class Method Summary collapse
-
.output_properties ⇒ Object
private
Provides mapping between symbols and the underlying Saxon property instances.
Instance Method Summary collapse
- #[](property) ⇒ Object
- #[]=(property, value) ⇒ Object
- #fetch(property, default = nil) ⇒ Object
-
#initialize(s9_serializer) ⇒ OutputProperties
constructor
private
A new instance of OutputProperties.
Constructor Details
#initialize(s9_serializer) ⇒ OutputProperties
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of OutputProperties.
35 36 37 |
# File 'lib/saxon/serializer.rb', line 35 def initialize(s9_serializer) @s9_serializer = s9_serializer end |
Instance Attribute Details
#s9_serializer ⇒ Object (readonly)
Returns the value of attribute s9_serializer.
32 33 34 |
# File 'lib/saxon/serializer.rb', line 32 def s9_serializer @s9_serializer end |
Class Method Details
.output_properties ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Provides mapping between symbols and the underlying Saxon property instances
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/saxon/serializer.rb', line 19 def self.output_properties @output_properties ||= Hash[ Saxon::S9API::Serializer::Property.values.map { |property| qname = property.getQName key = [ qname.getPrefix, qname.getLocalName.tr('-', '_') ].reject { |str| str == '' }.join('_').to_sym [key, property] } ] end |
Instance Method Details
#[](property) ⇒ Object
40 41 42 |
# File 'lib/saxon/serializer.rb', line 40 def [](property) s9_serializer.getOutputProperty(resolved_property(property)) end |
#[]=(property, value) ⇒ Object
46 47 48 |
# File 'lib/saxon/serializer.rb', line 46 def []=(property, value) s9_serializer.setOutputProperty(resolved_property(property), value) end |
#fetch(property) ⇒ Object #fetch(property, default) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/saxon/serializer.rb', line 55 def fetch(property, default = nil) explicit_value = self[property] if explicit_value.nil? && !default.nil? default else explicit_value end end |