Class: SFRP::Low::Structure

Inherits:
Element
  • Object
show all
Defined in:
lib/sfrp/low/element.rb

Instance Method Summary collapse

Methods inherited from Element

#to_s

Constructor Details

#initialize(kind_str, name_str, members) ⇒ Structure

Returns a new instance of Structure.



60
61
62
63
64
# File 'lib/sfrp/low/element.rb', line 60

def initialize(kind_str, name_str, members)
  @kind_str = kind_str
  @name_str = name_str
  @members = members
end

Instance Method Details

#pretty_codeObject



66
67
68
69
# File 'lib/sfrp/low/element.rb', line 66

def pretty_code
  inner = @members.map { |m| m.pretty_code(1) + "\n" }.join
  "#{@kind_str} #{@name_str} {\n#{inner}};"
end