Class: Leptris::XML::ParseOptions
- Inherits:
-
Object
- Object
- Leptris::XML::ParseOptions
- Defined in:
- lib/leptris/xml/parse_options.rb
Overview
Parser flags, mirroring LeptrisParseFlags in libleptris's public
headers. Pass an instance as Leptris::XML.parse(xml, options:).
Constant Summary collapse
- NOBLANKS =
Discard whitespace-only text nodes (runs between tags that contain nothing but spaces/tabs/newlines). Matches libxml2's XML_PARSE_NOBLANKS and Nokogiri's noblanks. Documents parsed this way do not round-trip pretty-printed formatting byte-for-byte.
Leptris::XML::FFI::LEPTRIS_PARSE_DROP_WS_TEXT
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(flags = Leptris::XML::FFI::LEPTRIS_PARSE_DEFAULT) ⇒ ParseOptions
constructor
A new instance of ParseOptions.
- #noblanks? ⇒ Boolean
- #|(other) ⇒ Object
Constructor Details
#initialize(flags = Leptris::XML::FFI::LEPTRIS_PARSE_DEFAULT) ⇒ ParseOptions
Returns a new instance of ParseOptions.
14 15 16 |
# File 'lib/leptris/xml/parse_options.rb', line 14 def initialize(flags = Leptris::XML::FFI::LEPTRIS_PARSE_DEFAULT) @flags = flags.to_i end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
12 13 14 |
# File 'lib/leptris/xml/parse_options.rb', line 12 def flags @flags end |
Class Method Details
.noblanks ⇒ Object
18 19 20 |
# File 'lib/leptris/xml/parse_options.rb', line 18 def self.noblanks new(NOBLANKS) end |
Instance Method Details
#noblanks? ⇒ Boolean
22 23 24 |
# File 'lib/leptris/xml/parse_options.rb', line 22 def noblanks? @flags & NOBLANKS != 0 end |
#|(other) ⇒ Object
26 27 28 |
# File 'lib/leptris/xml/parse_options.rb', line 26 def |(other) self.class.new(@flags | other.flags) end |