Sha256: 92ae24550f87a77151d180d085b5be216238a4ad942792c8d578aee96e6eba46
Contents?: true
Size: 850 Bytes
Versions: 2
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true module RaaP class MethodValue < Data.define( :receiver_value, :arguments, :method_name, :size ) def to_symbolic_call args, kwargs, block = arguments [:call, receiver_value, method_name, args, kwargs, block] end def call_str r = SymbolicCaller.new(receiver_value).eval "#{BindCall.inspect(r)}.#{method_name}(#{argument_str})#{block_str}" end private def argument_str args, kwargs, _ = SymbolicCaller.new(arguments).eval r = [] r << args.map(&:inspect).join(', ') if !args.empty? r << kwargs.map { |k ,v| "#{k}: #{BindCall.inspect(v)}" }.join(', ') if !kwargs.empty? r.join(', ') end def block_str _, _, block = SymbolicCaller.new(arguments).eval if block "{ }" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
raap-0.2.0 | lib/raap/method_value.rb |
raap-0.1.0 | lib/raap/method_value.rb |