Class: Evertils::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/evertils/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Type

Returns a new instance of 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

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



7
8
9
# File 'lib/evertils/type.rb', line 7

def params
  @params
end