Class: Grammar::Ruby::Code::Rescue
- Inherits:
-
Grammar::Ruby::Code
- Object
- Grammar::Ruby::Code
- Grammar::Ruby::Code::Rescue
- Defined in:
- lib/grammar/ruby/code.rb
Constant Summary
Constants inherited from Grammar::Ruby::Code
False, FalseTerminator, Implicit, Nil, Self, True
Instance Method Summary collapse
- #_always ⇒ Object
- #_codes ⇒ Object
- #_lines(text, indent = 0, op = nil, maxlen = 72) ⇒ Object
- #_never ⇒ Object
-
#initialize(exception = nil, var = nil) ⇒ Rescue
constructor
A new instance of Rescue.
Methods inherited from Grammar::Ruby::Code
[], #_and, #_assign, #_classname, #_code_self, #_data, #_def, #_dot, #_else, #_ensure, #_equal, #_immediate, #_inspect, #_locals, #_mid, #_not, #_or, #_question, #_rand, #_rcond, #_rescue, #_ror, #_rstep, #_splat, #_step, #_to_block, #_unless, #_until, #_while, #method_missing
Constructor Details
#initialize(exception = nil, var = nil) ⇒ Rescue
Returns a new instance of Rescue.
862 863 864 865 |
# File 'lib/grammar/ruby/code.rb', line 862 def initialize(exception=nil, var=nil) @exception = exception @var = var end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Grammar::Ruby::Code
Instance Method Details
#_always ⇒ Object
890 891 892 |
# File 'lib/grammar/ruby/code.rb', line 890 def _always false end |
#_codes ⇒ Object
866 867 868 869 870 871 |
# File 'lib/grammar/ruby/code.rb', line 866 def _codes codes = [] codes << @exception if @exception codes << @var if @var codes end |
#_lines(text, indent = 0, op = nil, maxlen = 72) ⇒ Object
872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
# File 'lib/grammar/ruby/code.rb', line 872 def _lines(text, indent=0, op=nil, maxlen=72) text[-2] -= 2 if text.last.empty? (last = text.last).concat("rescue") single = true if @exception last << ?\s single = @exception._lines(text, indent+1, nil, maxlen) last = text.last else single = true end if @var last.concat(" => ") @var._lines(text, indent+1, nil, maxlen) && single else single end end |
#_never ⇒ Object
893 894 895 |
# File 'lib/grammar/ruby/code.rb', line 893 def _never false end |