Class: Saxon::Serializer::OutputProperties::Accessor Private
- Inherits:
-
Object
- Object
- Saxon::Serializer::OutputProperties::Accessor
- Defined in:
- lib/saxon/serializer/output_properties.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The private wrapper class that manages getting and setting output properties on a Serializer in an idiomatic Ruby-like way.
Instance Attribute Summary collapse
- #s9_serializer ⇒ Object readonly private
Class Method Summary collapse
-
.output_properties ⇒ Object
private
Provides mapping between symbols and the underlying Saxon property instances.
Instance Method Summary collapse
- #[](property) ⇒ Object private
- #[]=(property, value) ⇒ Object private
- #fetch(property, default = nil) ⇒ Object private
-
#initialize(s9_serializer) ⇒ Accessor
constructor
private
A new instance of Accessor.
Constructor Details
#initialize(s9_serializer) ⇒ Accessor
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 Accessor.
41 42 43 |
# File 'lib/saxon/serializer/output_properties.rb', line 41 def initialize(s9_serializer) @s9_serializer = s9_serializer end |
Instance Attribute Details
#s9_serializer ⇒ Object (readonly)
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.
38 39 40 |
# File 'lib/saxon/serializer/output_properties.rb', line 38 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
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/saxon/serializer/output_properties.rb', line 25 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
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.
46 47 48 |
# File 'lib/saxon/serializer/output_properties.rb', line 46 def [](property) s9_serializer.getOutputProperty(resolved_property(property)) end |
#[]=(property, value) ⇒ 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.
52 53 54 |
# File 'lib/saxon/serializer/output_properties.rb', line 52 def []=(property, value) s9_serializer.setOutputProperty(resolved_property(property), value) end |
#fetch(property) ⇒ Object #fetch(property, default) ⇒ 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.
61 62 63 64 65 66 67 68 |
# File 'lib/saxon/serializer/output_properties.rb', line 61 def fetch(property, default = nil) explicit_value = self[property] if explicit_value.nil? && !default.nil? default else explicit_value end end |