class Hash

Public Instance Methods

to_zaml(z=ZAML.new) click to toggle source
# File lib/icss/serialization/zaml.rb, line 367
def to_zaml(z=ZAML.new)
  z.first_time_only(self) {
    z.nested {
      if empty? then z.emit('{}')
      else
        emitted = false
        each_pair{|k, v|
          z.no_comment(k){
            emitted = true
            z.nl
            z.prefix_structured_keys('? '){ k.to_zaml(z) }
            z.vpad(':', k)
            v.to_zaml(z)
          }
        }
        unless emitted then z.nl ; z.emit('{}') ; end
      end
    }
  }
end