Method: Hubic::Store#save

Defined in:
lib/hubic/store.rb

#saveObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hubic/store.rb', line 26

def save
    data = if @user
               ( begin 
                     YAML.load_file(@file)
                 rescue Errno::ENOENT
                 end || {} ).merge(@user => @data).to_yaml
           else
               @data
           end
    File.open(@file, 'w', 0600) {|io|
        io.write(data.to_yaml)
    }
end