Class: Twostroke::AST::Try
Instance Attribute Summary collapse
-
#catch_statements ⇒ Object
Returns the value of attribute catch_statements.
-
#catch_variable ⇒ Object
Returns the value of attribute catch_variable.
-
#finally_statements ⇒ Object
Returns the value of attribute finally_statements.
-
#try_statements ⇒ Object
Returns the value of attribute try_statements.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Twostroke::AST::Base
Instance Attribute Details
#catch_statements ⇒ Object
Returns the value of attribute catch_statements.
3 4 5 |
# File 'lib/twostroke/ast/try.rb', line 3 def catch_statements @catch_statements end |
#catch_variable ⇒ Object
Returns the value of attribute catch_variable.
3 4 5 |
# File 'lib/twostroke/ast/try.rb', line 3 def catch_variable @catch_variable end |
#finally_statements ⇒ Object
Returns the value of attribute finally_statements.
3 4 5 |
# File 'lib/twostroke/ast/try.rb', line 3 def finally_statements @finally_statements end |
#try_statements ⇒ Object
Returns the value of attribute try_statements.
3 4 5 |
# File 'lib/twostroke/ast/try.rb', line 3 def try_statements @try_statements end |
Instance Method Details
#collapse ⇒ Object
5 6 7 8 9 |
# File 'lib/twostroke/ast/try.rb', line 5 def collapse self.class.new try_statements: try_statements.map(&:collapse), catch_variable: catch_variable, catch_statements: (catch_statements && catch_statements.map(&:collapse)), finally_statements: (finally_statements && finally_statements.map(&:collapse)) end |
#walk(&bk) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/twostroke/ast/try.rb', line 11 def walk(&bk) if yield self try_statements.each { |s| s.walk &bk } catch_statements.each { |s| s.walk &bk } if catch_statements finally_statements.each { |s| s.walk &bk } if finally_statements end end |