Module: Cxxproject::Context

Included in:
PluginContext
Defined in:
lib/cxxproject/context.rb

Instance Method Summary collapse

Instance Method Details

#check_hash(hash, allowed) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/cxxproject/context.rb', line 4

def check_hash(hash,allowed)
  hash.keys.map do |k|
    error_string = ["error while evaluating \"#{@current_working_dir}/#{@current_project_file}\"",
                    "\"#{k}\" is not a valid specifier!",
                    "allowed specifiers: #{allowed}"].join($/)
    raise error_string unless allowed.include?(k)
  end
end

#get_as_array(hash, s) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/cxxproject/context.rb', line 13

def get_as_array(hash, s)
  res = hash[s]
  if res.is_a?(Array)
    return res
  end
  return [res]
end