Class: Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration.rb

Overview

Configuration class for the application.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Configuration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
# File 'lib/configuration.rb', line 10

def initialize(&block)
  block.call(self) if block_given?

  # Set default values if not set
  @storage_path ||= File.join(Dir.home, '.worklog')
  @log_level ||= :info
  @webserver_port ||= 3000
end

Instance Attribute Details

#log_levelObject

Returns the value of attribute log_level.



8
9
10
# File 'lib/configuration.rb', line 8

def log_level
  @log_level
end

#storage_pathObject

Returns the value of attribute storage_path.



8
9
10
# File 'lib/configuration.rb', line 8

def storage_path
  @storage_path
end

#webserver_portObject

Returns the value of attribute webserver_port.



8
9
10
# File 'lib/configuration.rb', line 8

def webserver_port
  @webserver_port
end