Class: XDG::Environment
- Inherits:
-
Object
- Object
- XDG::Environment
- Defined in:
- lib/xdg/environment.rb
Overview
A convenience wrapper to all XDG functionality.
Instance Method Summary collapse
- #cache_home ⇒ Object
- #config_dirs ⇒ Object
- #config_home ⇒ Object
- #data_dirs ⇒ Object
- #data_home ⇒ Object
-
#initialize(home: Paths::Home, directories: Paths::Directory, environment: ENV) ⇒ Environment
constructor
A new instance of Environment.
- #inspect ⇒ Object
- #runtime_dir ⇒ Object
- #state_home ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(home: Paths::Home, directories: Paths::Directory, environment: ENV) ⇒ Environment
Returns a new instance of Environment.
6 7 8 9 10 11 12 13 |
# File 'lib/xdg/environment.rb', line 6 def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV @cache = Cache.new(home:, directories:, environment:) @config = Config.new(home:, directories:, environment:) @data = Data.new(home:, directories:, environment:) @runtime = Runtime.new(environment:) @state = State.new(home:, directories:, environment:) freeze end |
Instance Method Details
#cache_home ⇒ Object
15 |
# File 'lib/xdg/environment.rb', line 15 def cache_home = cache.home |
#config_dirs ⇒ Object
19 |
# File 'lib/xdg/environment.rb', line 19 def config_dirs = config.directories |
#config_home ⇒ Object
17 |
# File 'lib/xdg/environment.rb', line 17 def config_home = config.home |
#data_dirs ⇒ Object
23 |
# File 'lib/xdg/environment.rb', line 23 def data_dirs = data.directories |
#data_home ⇒ Object
21 |
# File 'lib/xdg/environment.rb', line 21 def data_home = data.home |
#inspect ⇒ Object
33 |
# File 'lib/xdg/environment.rb', line 33 def inspect = "#<#{self.class}:#{object_id} #{self}>" |
#runtime_dir ⇒ Object
25 |
# File 'lib/xdg/environment.rb', line 25 def runtime_dir = runtime.home |
#state_home ⇒ Object
27 |
# File 'lib/xdg/environment.rb', line 27 def state_home = state.home |
#to_s ⇒ Object Also known as: to_str
29 |
# File 'lib/xdg/environment.rb', line 29 def to_s = "#{cache} #{config} #{data} #{runtime} #{state}" |