Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /opt/alt/ruby27/share/ruby/reline//key_stroke.rb
class Reline::KeyStroke
using Module.new {
refine Array do
def start_with?(other)
other.size <= size && other == self.take(other.size)
end
def bytes
self
end
end
}
def initialize(config)
@config = config
end
def match_status(input)
key_mapping.keys.select { |lhs|
lhs.start_with? input
}.tap { |it|
return :matched if it.size == 1 && (it.max_by(&:size)&.size&.== input.size)
return :matching if it.size == 1 && (it.max_by(&:size)&.size&.!= input.size)
return :matched if it.max_by(&:size)&.size&.< input.size
return :matching if it.size > 1
}
key_mapping.keys.select { |lhs|
input.start_with? lhs
}.tap { |it|
return it.size > 0 ? :matched : :unmatched
}
end
def expand(input)
lhs = key_mapping.keys.select { |item| input.start_with? item }.sort_by(&:size).reverse.first
return input unless lhs
rhs = key_mapping[lhs]
case rhs
when String
rhs_bytes = rhs.bytes
expand(expand(rhs_bytes) + expand(input.drop(lhs.size)))
when Symbol
[rhs] + expand(input.drop(lhs.size))
when Array
rhs
end
end
private
def key_mapping
@config.key_bindings
end
end
Name |
Size |
Last Modified |
Owner / Group |
Permissions |
Options |
.. | -- | March 03 2024 22:47:25 | root / linksafe | 0755 | |
key_actor | -- | March 03 2024 22:47:16 | root / linksafe | 0755 | |
unicode | -- | March 03 2024 22:47:16 | root / linksafe | 0755 | |
| | | | | |
ansi.rb | 4.734 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
config.rb | 8.596 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
general_io.rb | 1.015 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
history.rb | 1.869 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
key_actor.rb | 0.165 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
key_stroke.rb | 1.223 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
kill_ring.rb | 2.198 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
line_editor.rb | 72.721 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
unicode.rb | 18.542 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
version.rb | 0.037 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |
windows.rb | 9.036 KB | March 30 2023 12:34:08 | root / linksafe | 0644 | |