Class: Config::Sources::HashSource

Inherits:
Object
  • Object
show all
Defined in:
lib/config/sources/hash_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashSource

Returns a new instance of HashSource.



6
7
8
# File 'lib/config/sources/hash_source.rb', line 6

def initialize(hash)
  @hash = hash
end

Instance Attribute Details

#hashObject

Returns the value of attribute hash.



4
5
6
# File 'lib/config/sources/hash_source.rb', line 4

def hash
  @hash
end

Instance Method Details

#loadObject

returns hash that was passed in to initialize



11
12
13
# File 'lib/config/sources/hash_source.rb', line 11

def load
  hash.is_a?(Hash) ? hash : {}
end