Class: Saxon::ParserFeatures
- Inherits:
-
Object
- Object
- Saxon::ParserFeatures
- Includes:
- Enumerable
- Defined in:
- lib/saxon/parse_options.rb
Overview
Provides idiomatic access to parser properties
Instance Method Summary collapse
-
#[](uri) ⇒ Boolean?
Fetch the current value of a Parser Feature.
-
#[]=(uri, value) ⇒ Boolean
Set the value of a Parser Feature.
-
#each {|uri, value| ... } ⇒ Object
Iterate across each currently-set feature, in the same way as a hash.
-
#initialize(parse_options) ⇒ ParserFeatures
constructor
private
A new instance of ParserFeatures.
-
#to_h ⇒ Hash
The currently-set features as a (frozen) hash.
Constructor Details
#initialize(parse_options) ⇒ ParserFeatures
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 ParserFeatures.
88 89 90 |
# File 'lib/saxon/parse_options.rb', line 88 def initialize() @parse_options ||= end |
Instance Method Details
#[](uri) ⇒ Boolean?
Fetch the current value of a Parser Feature
102 103 104 105 106 |
# File 'lib/saxon/parse_options.rb', line 102 def [](uri) pf = .getParserFeatures return nil if pf.nil? || !pf.include?(uri) .getParserFeature(uri) end |
#[]=(uri, value) ⇒ Boolean
Set the value of a Parser Feature
113 114 115 116 |
# File 'lib/saxon/parse_options.rb', line 113 def []=(uri, value) .addParserFeature(uri, value) self[uri] end |
#each {|uri, value| ... } ⇒ Object
Iterate across each currently-set feature, in the same way as a hash
123 124 125 |
# File 'lib/saxon/parse_options.rb', line 123 def each(&block) to_h.each(&block) end |
#to_h ⇒ Hash
Returns the currently-set features as a (frozen) hash.
93 94 95 |
# File 'lib/saxon/parse_options.rb', line 93 def to_h (.getParserFeatures || {}).freeze end |