Class: KiCad::AST::Property

Inherits:
Node
  • Object
show all
Defined in:
lib/kicad/ast.rb

Overview

Properties

Instance Attribute Summary

Attributes inherited from Node

#children, #values

Instance Method Summary collapse

Methods inherited from Node

child_types, #children_of_type, #emit, #emit_compact, #emit_compacting, #initialize, to_class_name, to_symbol, value_types

Constructor Details

This class inherits a constructor from KiCad::AST::Node

Instance Method Details

#hidden=(h = true) ⇒ Object

Set or clear (hide) on the property_node



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/kicad/ast.rb', line 239

def hidden=(h = true)
  v = (h ? :yes : :no)
  if !effects                     # No effects yet
    prop = KiCad.parse(%Q{(effects(hide #{v}))})&.value
    @children.append(prop) if prop
  elsif (existing = effects.hide) # Effects and hide already
    existing.hide = v
  else                            # Create new (hide) node
    prop = KiCad.parse(%Q{(hide #{v})})&.value
    @children.append(prop) if prop
  end
end