Sha256: aaef6b66b17816d73c2b06b8f9aaf2822027729b86fefab4b38af579dccb2e9a

Contents?: true

Size: 481 Bytes

Versions: 7

Compression:

Stored size: 481 Bytes

Contents

class ArgsLoader
  def reset!
    @sexp = nil
  end

  def load(method_call)
    reset!
    load_method_add_arg(Ripper.sexp(method_call))
    return @sexp
  end

  private
  def load_method_add_arg(method_sexp)
    method_sexp.each do |s|
      next unless s.kind_of?(Array)

      s.each do |a|
        next unless a.kind_of?(Array)

        if a.first == :args_add_block
          @sexp ||= a
        else
          load_method_add_arg(s)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sandi_meter-1.2.0 spec/support/args_loader.rb
sandi_meter-1.1.8 spec/support/args_loader.rb
sandi_meter-1.1.7 spec/support/args_loader.rb
sandi_meter-1.1.6 spec/support/args_loader.rb
sandi_meter-1.1.5 spec/support/args_loader.rb
sandi_meter-1.0.5 spec/support/args_loader.rb
sandi_meter-1.0.4 spec/support/args_loader.rb