Class: LiquidXlsx::Validation::VariableUse
- Inherits:
-
Struct
- Object
- Struct
- LiquidXlsx::Validation::VariableUse
- Defined in:
- lib/liquid_xlsx/validation/usage.rb
Overview
One variable reference found in a template fragment.
segments is the lookup chain after the root: invoice.items.first.name
becomes root "invoice" with segments ["items", "first", "name"].
truncated marks a path the host application must not check past its last
segment: a dynamic lookup (items[idx].name) hides what comes next, and
reporting "no such field" for it would be a false alarm.
Instance Attribute Summary collapse
-
#root ⇒ Object
Returns the value of attribute root.
-
#segments ⇒ Object
Returns the value of attribute segments.
-
#truncated ⇒ Object
Returns the value of attribute truncated.
Instance Method Summary collapse
Instance Attribute Details
#root ⇒ Object
Returns the value of attribute root
13 14 15 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 13 def root @root end |
#segments ⇒ Object
Returns the value of attribute segments
13 14 15 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 13 def segments @segments end |
#truncated ⇒ Object
Returns the value of attribute truncated
13 14 15 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 13 def truncated @truncated end |
Instance Method Details
#path ⇒ Object
14 15 16 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 14 def path ([root] + Array(segments)).join(".") end |
#to_h ⇒ Object
22 23 24 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 22 def to_h { root: root, segments: Array(segments), truncated: truncated?, path: path } end |
#truncated? ⇒ Boolean
18 19 20 |
# File 'lib/liquid_xlsx/validation/usage.rb', line 18 def truncated? truncated ? true : false end |