Sha256: 7f8b42f8b66d7115158f6e1f50b1eda5762021b195e0f9f5ef3ff4aa30224543
Contents?: true
Size: 780 Bytes
Versions: 13
Compression:
Stored size: 780 Bytes
Contents
class PlistFontManager def initialize(plist_path) @plist_path = plist_path load_plist end def load_plist @plist = Plist.parse_xml(@plist_path) @plist['UIAppFonts'] ||= [] end def add_fonts(font_names) font_names.each do |font_name| add_font(font_name) end end def add_font(font_name) unless @plist['UIAppFonts'].include?(font_name) @plist['UIAppFonts'] << font_name save_plist Solara.logger.debug("#{font_name} added to UIAppFonts.") else Solara.logger.debug("#{font_name} already exists in UIAppFonts.") end end def save_plist File.open(@plist_path, 'w') do |file| file.write(Plist::Emit.dump(@plist)) end end end
Version data entries
13 entries across 13 versions & 1 rubygems