Spec-Zone.ru › Ruby 3.4

класс Reline::KeyActor::Base

Родитель:
Объект

Публичные Классовые Методы

new (mappings = nil)
Исходный код
# File lib/reline/key_actor/base.rb, line 2
def initialize(mappings = nil)
  @matching_bytes = {}
  @key_bindings = {}
  add_mappings(mappings) if mappings
end

Публичные Методы Экземпляров

add (key, func)
Исходный код
# File lib/reline/key_actor/base.rb, line 18
def add(key, func)
  (1...key.size).each do |size|
    @matching_bytes[key.take(size)] = true
  end
  @key_bindings[key] = func
end
add_mappings (mappings)
Исходный код
# File lib/reline/key_actor/base.rb, line 8
def add_mappings(mappings)
  add([27], :ed_ignore)
  128.times do |key|
    func = mappings[key]
    meta_func = mappings[key | 0b10000000]
    add([key], func) if func
    add([27, key], meta_func) if meta_func
  end
end
clear ()
Исходный код
# File lib/reline/key_actor/base.rb, line 33
def clear
  @matching_bytes.clear
  @key_bindings.clear
end
get (key)
Исходный код
# File lib/reline/key_actor/base.rb, line 29
def get(key)
  @key_bindings[key]
end
matching? (key)
Исходный код
# File lib/reline/key_actor/base.rb, line 25
def matching?(key)
  @matching_bytes[key]
end

Ruby Core © 1993–2024 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API