Skip to content

Commit

Permalink
Use variable and DRY code in MiqExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed Aug 27, 2019
1 parent 3558102 commit 731f964
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/miq_expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,9 @@ def self.quote(val, typ)
target = parse_field_or_tag(val)
value = target.tag_path_with
col_type = target.try(:column_type) || "string"
return target ? "<value ref=#{target.model.to_s.downcase}, type=#{col_type}>#{value}</value>" : "<value type=#{col_type}>#{value}</value>"

reference_attribute = target ? "ref=#{target.model.to_s.downcase}, " : " "
return "<value #{reference_attribute}type=#{col_type}>#{value}</value>"
end
case typ.to_s
when "string", "text", "boolean", nil
Expand Down

0 comments on commit 731f964

Please sign in to comment.