Class: Karabiner::Appdef

Inherits:
Object
  • Object
show all
Includes:
XmlTree
Defined in:
lib/karabiner/appdef.rb

Constant Summary collapse

AVAILABLE_OPTIONS =
%i[
  equal
  prefix
  suffix
].freeze

Instance Method Summary collapse

Methods included from XmlTree

#add_child, #search_childs, #to_xml

Constructor Details

#initialize(appname, options) ⇒ Appdef

Returns a new instance of Appdef.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/karabiner/appdef.rb', line 12

def initialize(appname, options)
  property = Karabiner::Property.new("appname", appname)
  add_child(property)

  options.each do |option, value|
    raise "Unavailable option: #{property}" unless AVAILABLE_OPTIONS.include?(option)

    property = Karabiner::Property.new(option, value)
    add_child(property)
  end
end