Method: Evertils::Type#initialize

Defined in:
lib/evertils/type.rb

#initialize(path) ⇒ Type



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/evertils/type.rb', line 9

def initialize(path)
  begin
    type_path = File.expand_path(path)
    contents = YAML.load_file(type_path)

    return if contents.empty?

    translate_variables(contents)

    @params = OpenStruct.new(contents)
  rescue Errno::ENOENT
    Notify.error("File doesn't exist - #{type_path}")
  end
end