Sha256: 34bbeaed7ceaa38566a019eda488aea6a6229abaf5209657d80e56a31fa4ce15
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
module XDG class BaseDir # # The BaseDir::Mixin module can be used to add XDG base directory # methods to your own classes. # # class MyAppConfig # include XDG::BaseDir::Mixin # # def subdirectory # 'myapp' # end # end # # c = MyAppConfig.new # # c.config.home.list #=> ['~/.config/myapp'] # module Mixin # @todo do we need this? extend self # Override this method to change the subdirectory of the mixin. def subdirectory nil end # def home File.expand_path('~') end # def data obj = XDG['DATA'].with_subdirectory(subdirectory) class << obj def home XDG['DATA_HOME'].with_subdirectory(subdirectory) end def dirs XDG['DATA_DIRS'].with_subdirectory(subdirectory) end end return obj end # def config obj = XDG['CONFIG'].with_subdirectory(subdirectory) class << obj def home XDG['CONFIG_HOME'].with_subdirectory(subdirectory) end def dirs XDG['CONFIG_DIRS'].with_subdirectory(subdirectory) end def work XDG['CONFIG_WORK'].with_subdirectory(subdirectory) end end return obj end # def cache obj = XDG['CACHE'].with_subdirectory(subdirectory) class << obj def home XDG['CACHE_HOME'].with_subdirectory(subdirectory) end def dirs XDG['CACHE_DIRS'].with_subdirectory(subdirectory) end def work XDG['CACHE_WORK'].with_subdirectory(subdirectory) end end return obj end end end end # Copyright (c) 2008 Rubyworks
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xdg-2.2.5 | lib/xdg/base_dir/mixin.rb |
xdg-2.2.4 | lib/xdg/base_dir/mixin.rb |
xdg-2.2.3 | lib/xdg/base_dir/mixin.rb |