Class: Kleiber::Settings

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

Overview

Provides access to settings of library

Author:

Constant Summary collapse

REQUIRED_KEYS =

backporting for old ruby versions

%w(name prefix path guest_port host_port host).map(&:to_sym)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Settings

Returns a new instance of Settings.



15
16
17
# File 'lib/kleiber/settings.rb', line 15

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



13
14
15
# File 'lib/kleiber/settings.rb', line 13

def path
  @path
end

Instance Method Details

#projectsArray

Returns projects settings hash

Returns:

  • (Array)

    projects hash



21
22
23
# File 'lib/kleiber/settings.rb', line 21

def projects
  config[:projects]
end

#symphoniesHash

Returns symphonies settings

Returns:

  • (Hash)


39
40
41
# File 'lib/kleiber/settings.rb', line 39

def symphonies
  config[:symphonies]
end

#tasksHash

Returns tasks settings hash

Returns:

  • (Hash)

    tasks hash



27
28
29
# File 'lib/kleiber/settings.rb', line 27

def tasks
  config[:tasks]
end

#terminalHash

Returns terminal settings

Returns:

  • (Hash)


33
34
35
# File 'lib/kleiber/settings.rb', line 33

def terminal
  config[:terminal]
end

#valid?Boolean

Validates settings

Returns:

  • (Boolean)

    validation result



45
46
47
48
49
# File 'lib/kleiber/settings.rb', line 45

def valid?
  private_methods.map do |m|
    send(m) if m.to_s.start_with?('validate_')
  end.compact.all?
end