some cc driven cleanup

bit anoying that the builtin engine is used
Even it is not as well configurable as preferred reek.
Still, found one minor bug
This commit is contained in:
2019-10-02 17:42:24 +03:00
parent 48e18ac9cd
commit fd8a3e9cc5
9 changed files with 42 additions and 15 deletions

View File

@ -38,9 +38,9 @@ module Ruby
def to_s(depth = 0)
parts = "if(#{@condition})\n"
parts += " #{@if_true.to_s(depth + 1)}\n" if(@if_true)
parts += " #{@if_true.to_s(1)}\n" if(@if_true)
parts += "else\n" if(@if_false)
parts += " #{@if_false.to_s(depth + 1)}\n" if(@if_false)
parts += " #{@if_false.to_s(1)}\n" if(@if_false)
parts += "end\n"
at_depth(depth , parts )
end

View File

@ -16,16 +16,8 @@ module Vool
def initialize( name , supe , body)
@name = name
@super_class_name = supe || :Object
case body
when MethodExpression
@body = Statements.new([body])
when Statements
@body = body
when nil
@body = Statements.new([])
else
raise "what body #{body}"
end
raise "what body #{body}" unless body.is_a?(Statements)
@body = body
end
# This creates the Parfait class.

View File

@ -52,8 +52,8 @@ module Vool
def to_s(depth = 0)
parts = "if (#{@condition.to_s(0)})\n"
parts += " #{@if_true}\n" if @if_true
parts += "else\n" if(@false)
parts += " #{@if_false}\n" if(@false)
parts += "else\n" if(@if_false)
parts += " #{@if_false}\n" if(@if_false)
parts += "end\n"
at_depth(depth , parts )
end