Sha256: f1c15589a58915399a9678723b96670cb79da6c8218e7b0cc5c66208f2a55efe

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'rubygems'
require 'parse_tree'
require 'sexp_processor'

module Reek

  class Printer < SexpProcessor
    def self.print(sexp)
      new.print(sexp)
    end

    def initialize
      super
      @require_empty = false
      @report = ''
    end

    def print(sexp)
      @report = sexp.inspect
      process(sexp)
      @report
    end

    def process_lvar(exp)
      @report = exp[1].inspect
      s(exp)
    end

    def process_dvar(exp)
      @report = exp[1].inspect
      s(exp)
    end

    def process_gvar(exp)
      @report = exp[1].inspect
      s(exp)
    end

    def process_const(exp)
      @report = exp[1].inspect
      s(exp)
    end

    def process_call(exp)
      @report = "#{exp[1]}.#{exp[2]}"
      @report += "(#{exp[3]})" if exp.length > 3
      s(exp)
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-0.0.1 lib/reek/printer.rb
reek-0.1.0 lib/reek/printer.rb