Class: MetaCommit::Configuration

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

Instance Method Summary collapse

Instance Method Details

#fill_from_hash(hash) ⇒ MetaCommit::Configuration

Fill config values from yaml file

Parameters:

  • hash (Hash)

Returns:



21
22
23
24
# File 'lib/meta_commit/configuration.rb', line 21

def fill_from_hash(hash)
  hash.each {|key, value| set(key.to_sym, value)}
  self
end

#fill_from_yaml_file(path) ⇒ MetaCommit::Configuration

Fill config values from yaml file

Parameters:

  • path (String)

Returns:



29
30
31
# File 'lib/meta_commit/configuration.rb', line 29

def fill_from_yaml_file(path)
  fill_from_hash read_from_yaml(path)
end

#get(key) ⇒ Object

Get the configuration value by key

Parameters:

  • key (Symbol)

    configuration key

Returns:

  • (Object)

    configuration value



14
15
16
# File 'lib/meta_commit/configuration.rb', line 14

def get(key)
  self[key]
end

#set(key, value) ⇒ Object

Set the configuration key

Parameters:

  • key (Symbol)

    configuration key

  • value (Object)

    configuration value



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

def set(key, value)
  self[key] = value
end