Class: Xkbcommon::Keymap
- Inherits:
-
Object
- Object
- Xkbcommon::Keymap
- Extended by:
- Forwardable
- Defined in:
- lib/xkbcommon/keymap.rb,
lib/xkbcommon/keymap/parser.rb
Defined Under Namespace
Classes: Parser
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#to_native ⇒ Object
readonly
Returns the value of attribute to_native.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context, keymap) ⇒ Keymap
constructor
A new instance of Keymap.
- #to_s(format: Libxkbcommon::XKB_KEYMAP_USE_ORIGINAL_FORMAT) ⇒ Object
Constructor Details
#initialize(context, keymap) ⇒ Keymap
Returns a new instance of Keymap.
13 14 15 16 17 18 19 |
# File 'lib/xkbcommon/keymap.rb', line 13 def initialize(context, keymap) @context = context @to_native = keymap @parser = Parser.new(self) ObjectSpace.define_finalizer(self, self.class.finalize(to_native)) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
21 22 23 |
# File 'lib/xkbcommon/keymap.rb', line 21 def context @context end |
#to_native ⇒ Object (readonly)
Returns the value of attribute to_native.
21 22 23 |
# File 'lib/xkbcommon/keymap.rb', line 21 def to_native @to_native end |
Class Method Details
.finalize(native) ⇒ Object
8 9 10 |
# File 'lib/xkbcommon/keymap.rb', line 8 def finalize(native) Proc.new { Libxkbcommon.xkb_keymap_unref(native) } end |
Instance Method Details
#to_s(format: Libxkbcommon::XKB_KEYMAP_USE_ORIGINAL_FORMAT) ⇒ Object
24 25 26 |
# File 'lib/xkbcommon/keymap.rb', line 24 def to_s(format: Libxkbcommon::XKB_KEYMAP_USE_ORIGINAL_FORMAT) Libxkbcommon.xkb_keymap_get_as_string(to_native, format) end |