Class: C::Block
- Defined in:
- lib/cast/c_nodes.rb,
lib/cast/to_s.rb,
lib/cast/c_nodes.rb
Overview
Statements
Constant Summary
Constants inherited from Node
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
Methods inherited from Statement
Methods inherited from Node
#==, #=~, abstract, add_field, #assert_invariants, #attached?, child, #clone, #depth_first, #detach, #detached?, #dup, #each, #eql?, field, #fields, fields, #hash, inherited, initializer, #insert_next, #insert_prev, #inspect, inspect1, #list_next, #list_prev, #match?, #method_missing, new_at, #next, #node_after, #node_before, #postorder, #preorder, #prev, #remove_node, #replace_node, #replace_with, #reverse_depth_first, #reverse_each, #reverse_postorder, #reverse_preorder, subclasses_recursive, #swap_with
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class C::Node
Instance Method Details
#to_s(hanging = false) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cast/to_s.rb', line 80 def to_s(hanging=false) str = stmts.map do |s| if s.is_a? Statement s.to_s else indent(s.to_s) end end.join("\n") str << "\n" unless str == '' str = "{\n" << str << "}" if hanging if labels.empty? return str else return "\n" << label(str) end else return label(str) end end |