Class: Grammar::Ruby::Code::Call

Inherits:
List show all
Defined in:
lib/grammar/ruby/code.rb

Direct Known Subclasses

Brackets, Method

Constant Summary

Constants inherited from Grammar::Ruby::Code

False, FalseTerminator, Implicit, Nil, Self, True

Instance Method Summary collapse

Methods inherited from List

#_always, #_never, #_operator, #_operator0, #_paren

Methods inherited from Grammar::Ruby::Code

[], #_always, #_and, #_assign, #_classname, #_code_self, #_data, #_def, #_dot, #_else, #_ensure, #_equal, #_immediate, #_inspect, #_locals, #_mid, #_never, #_not, #_or, #_question, #_rand, #_rcond, #_rescue, #_ror, #_rstep, #_splat, #_step, #_to_block, #_unless, #_until, #_while, #method_missing

Constructor Details

#initialize(receiver, *args) ⇒ Call

Returns a new instance of Call.



829
830
831
832
# File 'lib/grammar/ruby/code.rb', line 829

def initialize(receiver, *args)
    @receiver = receiver
    @operands = args
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Grammar::Ruby::Code

Instance Method Details

#_codesObject



833
834
835
# File 'lib/grammar/ruby/code.rb', line 833

def _codes
    [@receiver].concat(@operands)
end

#_lines(text, indent = 0, op = nil, maxlen = 72) ⇒ Object



836
837
838
839
840
841
842
843
844
845
# File 'lib/grammar/ruby/code.rb', line 836

def _lines(text, indent=0, op=nil, maxlen=72)
    single = @receiver._lines(text, indent, op, maxlen)
    text.last << op
    if super(text, indent+2, nil, maxlen)
        single
    else
        text << indent << ""
        nil
    end
end