Class: Alx::Configuration
- Inherits:
-
Object
- Object
- Alx::Configuration
- Defined in:
- lib/alx/configuration.rb
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/alx/configuration.rb', line 19 def initialize @conf = {} @conf[ :alx_home ] = ENV[ 'HOME' ] + "/#{CONF_BASE_DIR}" @conf[ :conf_file ] = @conf[ :alx_home ] + "/#{CONF_FILE}" @conf[ :default_shelf_dir ] = @conf[ :alx_home ] + "/#{LIB_BASE_DIR}/#{DEFAULT_SHELF}" FileUtils::mkdir_p( @conf[ :default_shelf_dir ] ) create_default_config_if_needed( @conf[ :conf_file ] ) from_conf_file = load_config( @conf[ :conf_file ] ) @conf.merge!( from_conf_file ) @conf[ :editor ] = ENV[ 'EDITOR' ] if ENV[ 'EDITOR' ] @conf[ :command ] = ARGV[ 0 ] @conf[ :rest ] = ARGV[ 1..-1 ] end |
Instance Method Details
#hash ⇒ Object
35 36 37 |
# File 'lib/alx/configuration.rb', line 35 def hash @conf end |