Permalink
Browse files

Removed "== true" checks

  • Loading branch information...
1 parent 0eb693b commit 673f5077f304c95c1745b182187d0d4194d30b71 @markus1189 markus1189 committed Jul 3, 2012
Showing with 19 additions and 19 deletions.
  1. +1 −1 bin/dot2ruby
  2. +2 −2 bin/gem2gv
  3. +3 −3 bin/ruby2gv
  4. +1 −1 bin/xml2gv
  5. +10 −10 lib/graphviz.rb
  6. +2 −2 lib/graphviz/xml.rb
View
@@ -83,7 +83,7 @@ end
xFile = ARGV[0]
-if xFile.nil? == true
+if xFile.nil?
usage( )
exit
end
View
@@ -28,7 +28,7 @@ class Gem2Gv
end
def out( xFormat = "dot", xFile = nil )
- if xFile.nil? == true
+ if xFile.nil?
@oGraph.output( xFormat => String )
else
@oGraph.output( xFormat => xFile )
@@ -154,7 +154,7 @@ end
xGem = ARGV[0]
-if xGem.nil? == true
+if xGem.nil?
usage( )
exit
end
View
@@ -44,7 +44,7 @@ class Rb2Gv
end
def out( xFormat = "dot", xFile = nil )
- if xFile.nil? == true
+ if xFile.nil?
@oGraph.output( xFormat => String )
else
@oGraph.output( xFormat => xFile )
@@ -54,7 +54,7 @@ class Rb2Gv
private
def gv_newNode( xNode, xShape = "box", xColor = nil )
xNodeName = xNode.gsub( /[^a-zA-Z0-9]/, "_" )
- if xColor.nil? == true
+ if xColor.nil?
@oGraph.add_nodes( xNodeName, "label" => xNode, "shape" => xShape )
else
@oGraph.add_nodes( xNodeName, "label" => xNode, "shape" => xShape, "style" => "filled", "color" => xColor )
@@ -226,7 +226,7 @@ end
xFile = ARGV[0]
-if xFile.nil? == true
+if xFile.nil?
usage( )
exit
end
View
@@ -87,7 +87,7 @@ end
xFile = ARGV[0]
-if xFile.nil? == true
+if xFile.nil?
usage( )
exit
end
View
@@ -430,7 +430,7 @@ def output( hOpts = {} )
lNotHugly = []
@elements_order.each { |kElement|
- if xLastType.nil? == true or xLastType != kElement["type"]
+ if xLastType.nil? or xLastType != kElement["type"]
if xData.length > 0
case xLastType
@@ -510,7 +510,7 @@ def output( hOpts = {} )
xValue = xValue.to_s unless xValue.nil? or [Class, TrueClass, FalseClass].include?(xValue.class)
case xKey.to_s
when "use"
- if PROGRAMS.index( xValue ).nil? == true
+ if PROGRAMS.index( xValue ).nil?
raise ArgumentError, "can't use '#{xValue}'"
end
@prog = xValue
@@ -559,7 +559,7 @@ def output( hOpts = {} )
@nothugly = false
end
else
- if FORMATS.index( xKey.to_s ).nil? == true
+ if FORMATS.index( xKey.to_s ).nil?
raise ArgumentError, "output format '#{xValue}' invalid"
end
hOutput[xKey.to_s] = xValue
@@ -625,14 +625,14 @@ def output( hOpts = {} )
xOtherOptions = ""
xOtherOptions += " -s#{@scale}" unless @scale.nil?
- xOtherOptions += " -y" if @inverty == true
+ xOtherOptions += " -y" if @inverty
unless @no_layout.nil?
xOtherOptions += " -n"
xOtherOptions += "2" if @no_layout.to_i == 2
end
- xOtherOptions += " -x" if @reduce_graph == true
- xOtherOptions += " -Lg" if @Lg == true
- xOtherOptions += " -LO" if @LO == true
+ xOtherOptions += " -x" if @reduce_graph
+ xOtherOptions += " -Lg" if @Lg
+ xOtherOptions += " -LO" if @LO
xOtherOptions += " -Ln#{@Ln}" unless @LN.nil?
xOtherOptions += " -LU#{@LU}" unless @LU.nil?
xOtherOptions += " -LC#{@LC}" unless @LC.nil?
@@ -878,14 +878,14 @@ def initialize( xGraphName, hOpts = {}, &block )
hOpts.each do |xKey, xValue|
case xKey.to_s
when "use"
- if PROGRAMS.index( xValue.to_s ).nil? == true
+ if PROGRAMS.index( xValue.to_s ).nil?
raise ArgumentError, "can't use '#{xValue}'"
end
@prog = xValue.to_s
when "parent"
@oParentGraph = xValue
when "type"
- if GRAPHTYPE.index( xValue.to_s ).nil? == true
+ if GRAPHTYPE.index( xValue.to_s ).nil?
raise ArgumentError, "graph type '#{xValue}' unknow"
end
@oGraphType = xValue.to_s
@@ -982,7 +982,7 @@ def self.escape(str, opts = {} ) #:nodoc:
}.merge(opts)
if (options[:force] or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_]*\Z/ ).nil?)
- unless options[:unquote_empty] == true and str.size == 0
+ unless options[:unquote_empty] and str.size == 0
'"' + str.gsub('"', '\\"').gsub("\n", '\\\\n') + '"'
end
else
View
@@ -72,7 +72,7 @@ def parse_xml_node( xml_node ) #:nodoc:
@node_name.succ!
label = xml_node.name
- if xml_node.has_attributes? == true and @show_attributes == true
+ if xml_node.has_attributes? and @show_attributes
label = "{ " + xml_node.name
xml_node.attributes.each do |xName, xValue|
@@ -84,7 +84,7 @@ def parse_xml_node( xml_node ) #:nodoc:
@graph.add_nodes( local_node_name, "label" => label, "color" => "blue", "shape" => "record" )
## Act: Search and add Text nodes
- if xml_node.has_text? == true and @show_text == true
+ if xml_node.has_text? and @show_text
text_node_name = local_node_name.clone
text_node_name << "111"

0 comments on commit 673f507

Please sign in to comment.