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, #initialize, to_class_name, to_symbol, value_types

Constructor Details

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

Instance Method Details

#hide=(h = true) ⇒ Object

Set or clear (hide) on the property_node



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/kicad/ast.rb', line 193

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