Method: Bedouin::Environment::DSL#resolve_parent

Defined in:
lib/bedouin/environment.rb

#resolve_parent(parent) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bedouin/environment.rb', line 22

def resolve_parent(parent)
  parent_hash = case parent
  when String
    parent_path = File.expand_path(parent, File.dirname(@filename))
    Environment.parse(parent_path)
  when NilClass
    nil
  else
    parent
  end

  unless parent_hash.respond_to? :to_h
    raise ArgumentError.new "#{parent.class} not a valid type for environment parent"
  end

  parent_hash
end