Class: Gem::Release::Config

Inherits:
Object
  • Object
show all
Includes:
Helper::Hash
Defined in:
lib/gem/release/config.rb,
lib/gem/release/config/env.rb,
lib/gem/release/config/files.rb

Defined Under Namespace

Classes: Env, Files

Constant Summary collapse

SOURCES =
[Env, Files]

Constants included from Helper::Hash

Helper::Hash::MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::Hash

#deep_merge, #except, #only, #symbolize_keys

Constructor Details

#initializeConfig

Returns a new instance of Config.


14
15
16
# File 'lib/gem/release/config.rb', line 14

def initialize
  @opts = load
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts


10
11
12
# File 'lib/gem/release/config.rb', line 10

def opts
  @opts
end

Instance Method Details

#[](key) ⇒ Object


18
19
20
# File 'lib/gem/release/config.rb', line 18

def [](key)
  opts[key]
end

#commonObject


26
27
28
# File 'lib/gem/release/config.rb', line 26

def common
  opts.reject { |_, value| value.is_a?(Hash) }
end

#for(key) ⇒ Object


22
23
24
# File 'lib/gem/release/config.rb', line 22

def for(key)
  common.merge(self[key] || {})
end