lib/view/helpers/ext/configuration.rb in lipsiadmin-4.1.8 vs lib/view/helpers/ext/configuration.rb in lipsiadmin-5.0.0
- old
+ new
@@ -12,12 +12,13 @@
# Returns the configuration as a string.
# Optionally you can specify the indentation spaces.
def to_s(indent=1)
return if self.empty?
- i = (" "*indent)
+ i = (" "*indent)
s = self.size > 0 ? "\n" : " "
- "{#{s}" + self.reject { |k,v| k.blank? || v.to_s.blank? }.collect { |k,v| "#{i*2}#{k}: #{s(v)}" if k != :var }.join(",#{s}") + "#{s}#{i}}"
+ r = "{#{s}" + self.collect { |k,v| "#{i*2}#{k}: #{s(v)}" if k != :var }.join(",#{s}") + "#{s}#{i if i.size > 1}}"
+ return r =~ /\{\s*\}/ ? "" : r
end
private
def javascript_object_for(object)
case object
\ No newline at end of file