Standard initializers seem better. Leaning toward b)


  # a)
  plist_opts = {
    :filename => "car.plist",
    :type => :vehicle_plist,
    :save_format => binary,
    :autoload => true,
    :autosave => false
  }

  car = Plist4r.new(plist_opts) {
    road_legal true
    brake_light_color "red"
  }

  car.save



  # b)
  car = Plist4r.new("car.plist")

  car.type = :vehicle_plist
  car.load # also detects plist type

  # not sure what to call this method
  # it overwrites any existing keys,
  # appending the new/replacement keys
  car << do
    road_legal true
    brake_light_color "red"
  end

  car.save(:binary => true)

-- 
Posted via http://www.ruby-forum.com/.