Class: Karabiner::Item
- Inherits:
-
Object
- Object
- Karabiner::Item
- Defined in:
- lib/karabiner/item.rb
Constant Summary collapse
- AVAILABLE_OPTIONS =
%i[ not only config_not config_only device_not device_only ].freeze
Constants included from DSL::Item
DSL::Item::AVAILABLE_PROPERTIES
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Item
constructor
A new instance of Item.
- #to_xml ⇒ Object
Methods included from DSL::Item
#execute, #invoke, #remap, #show_message
Methods included from XmlTree
Constructor Details
#initialize(name, options = {}) ⇒ Item
Returns a new instance of Item.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/karabiner/item.rb', line 17 def initialize(name, = {}) @skip_identifier = .delete(:skip_identifier) if name property = Karabiner::Property.new("name", name) add_child(property) end .each do |option, value| raise "Unavailable option: #{option}" unless AVAILABLE_OPTIONS.include?(option) property = Karabiner::Property.new(option, value) add_child(property) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Karabiner::DSL::Item
Instance Method Details
#to_xml ⇒ Object
33 34 35 36 37 38 |
# File 'lib/karabiner/item.rb', line 33 def to_xml validate_name_existence generate_identifier unless @skip_identifier super end |