Class: Iba::MethodCallExpression
- Inherits:
-
DisplayableExpression
- Object
- BaseExpression
- DisplayableExpression
- Iba::MethodCallExpression
- Defined in:
- lib/iba.rb
Instance Attribute Summary collapse
-
#_args ⇒ Object
readonly
Returns the value of attribute _args.
-
#_method ⇒ Object
readonly
Returns the value of attribute _method.
-
#_reciever ⇒ Object
readonly
Returns the value of attribute _reciever.
Instance Method Summary collapse
- #_display_subexpressions(bnd) ⇒ Object
- #_evaluate(bnd) ⇒ Object
- #_to_s ⇒ Object
-
#initialize(reciever, methodname, args) ⇒ MethodCallExpression
constructor
A new instance of MethodCallExpression.
Methods inherited from DisplayableExpression
Methods inherited from BaseExpression
#!=, #==, #_display, #_wrap, #coerce, #method_missing, #respond_to_missing?, #to_s
Constructor Details
#initialize(reciever, methodname, args) ⇒ MethodCallExpression
Returns a new instance of MethodCallExpression.
187 188 189 190 191 192 |
# File 'lib/iba.rb', line 187 def initialize(reciever, methodname, args) super() @_reciever = reciever @_method = methodname @_args = args.map { |a| _wrap(a) } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Iba::BaseExpression
Instance Attribute Details
#_args ⇒ Object (readonly)
Returns the value of attribute _args.
185 186 187 |
# File 'lib/iba.rb', line 185 def _args @_args end |
#_method ⇒ Object (readonly)
Returns the value of attribute _method.
185 186 187 |
# File 'lib/iba.rb', line 185 def _method @_method end |
#_reciever ⇒ Object (readonly)
Returns the value of attribute _reciever.
185 186 187 |
# File 'lib/iba.rb', line 185 def _reciever @_reciever end |
Instance Method Details
#_display_subexpressions(bnd) ⇒ Object
210 211 212 213 214 |
# File 'lib/iba.rb', line 210 def _display_subexpressions(bnd) rcv = @_reciever._display(bnd) args = @_args.map { |arg| arg._display(bnd) } [rcv, *args].compact.join(", ") end |
#_evaluate(bnd) ⇒ Object
204 205 206 207 208 |
# File 'lib/iba.rb', line 204 def _evaluate(bnd) rcv = @_reciever._evaluate(bnd) args = @_args.map { |arg| arg._evaluate(bnd) } rcv.send @_method, *args end |
#_to_s ⇒ Object
194 195 196 197 198 199 200 201 202 |
# File 'lib/iba.rb', line 194 def _to_s if @_method == :[] _index_to_s elsif _method_is_operator? _operator_to_s else _regular_method_to_s end end |