Class: Coradoc::CoreModel::IncludeOptions
- Defined in:
- lib/coradoc/core_model/include_options.rb
Overview
Typed options for an include directive, parsed once at construction.
Each asciidoctor selector (tags / lines / leveloffset / indent / encoding) gets one typed attribute. Selectors downstream operate on the typed form, never re-parsing the raw string (DRY).
tags Array<String> ["body"], [] when unspecified
tags_wildcard Boolean true for tags=*
tags_inverted Boolean true for tags=**
lines_spec String? raw "1..2;5;7..8" — parsed by Lines selector
leveloffset IncludeLevelOffset?
indent Integer? 0 = strip, N = re-indent, nil = passthrough
file_encoding String? passed through to resolver for File.read
Instance Attribute Summary
Attributes inherited from Base
#element_attributes, #id, #metadata_entries, #title
Class Method Summary collapse
-
.from_hash(attrs) ⇒ IncludeOptions
Build from a flat hash of asciidoctor-style key/value strings.
Instance Method Summary collapse
-
#conflict_resolved_to_lines? ⇒ Boolean
True when both selectors were specified (lines wins).
-
#lines? ⇒ Boolean
Whether the lines selector is in effect.
-
#tags? ⇒ Boolean
Whether any tag selector is in effect.
Methods inherited from Base
#accept, #attr, #flat_text, #metadata, #semantically_equivalent?, #set_attr, #set_metadata
Class Method Details
.from_hash(attrs) ⇒ IncludeOptions
Build from a flat hash of asciidoctor-style key/value strings. Whitespace around keys and values is trimmed (SPEC 6.3).
48 49 50 |
# File 'lib/coradoc/core_model/include_options.rb', line 48 def self.from_hash(attrs) new(build_args(attrs)) end |
Instance Method Details
#conflict_resolved_to_lines? ⇒ Boolean
True when both selectors were specified (lines wins).
39 40 41 |
# File 'lib/coradoc/core_model/include_options.rb', line 39 def conflict_resolved_to_lines? lines? && end |
#lines? ⇒ Boolean
Whether the lines selector is in effect. Tags are ignored when lines is set — matches asciidoctor precedence (SPEC 3.5).
29 30 31 |
# File 'lib/coradoc/core_model/include_options.rb', line 29 def lines? !lines_spec.nil? && !lines_spec.strip.empty? end |
#tags? ⇒ Boolean
Whether any tag selector is in effect.
34 35 36 |
# File 'lib/coradoc/core_model/include_options.rb', line 34 def || || !.empty? end |