Module: Tabry::Models::Option

Defined in:
lib/tabry/models/option.rb

Class Method Summary collapse

Class Method Details

.new(**args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tabry/models/option.rb', line 11

def self.new(**args)
  # TODO: assert type
  hash = args[:raw]
  case hash["type"]
  when "const"
    ConstOption.new(**args)
  when "shell"
    ShellOption.new(**args)
  when "method"
    MethodOption.new(**args)
  when "include"
    IncludeOption.new(**args)
  when "file"
    FileOption.new(**args)
  when "dir"
    DirOption.new(**args)
  else
    raise ConfigError, "unknown option type #{hash["type"]}"
  end
end