Sha256: 8f55b235fa6b23712a67aed3b57ca074640b9bc546bf47844729b2795477a5a9
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
module Plister class Preferences attr_reader :path def initialize(path = nil) @path = path || "/Users/#{Plister.user}/.osx.yml" end def set!(verbose: false) data.each do |type, domains| domains.each do |domain, prefs| puts "Setting #{type} preferences for #{domain}" if verbose plist = Plist.new(domain, type: type) plist.merge(prefs) plist.write end end end def domains @domains ||= data.map { |_k, v| v.keys }.flatten end private def data @data ||= YAML.load(contents) end def contents @contents ||= File.open(path).read end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plister-0.1.1 | lib/plister/preferences.rb |
plister-0.1.0 | lib/plister/preferences.rb |