Sha256: 4f67324e625d77d6f79d8d2649776099138dd60a68a0e3d6da03958a07707bf7
Contents?: true
Size: 855 Bytes
Versions: 38
Compression:
Stored size: 855 Bytes
Contents
module Redcar class Keymap def self.build(name, platform, &block) Builder.new(name, platform, &block).keymap end attr_reader :name, :platforms attr_accessor :map def initialize(name, platforms) @name, @platforms = name, [*platforms] @map = {} end def link(key_string, command) @map[key_string] = command end def command(key_string) @map[key_string] end def command_to_key(command) @map.invert[command] end def length @map.length end def merge(other) keymap = Keymap.new(@name, @platforms) (@map.keys & other.map.keys).each do |key| puts "conflicting keybinding #{key}: #{@map[key].inspect} is being overwritten by #{other.map[key].inspect}" end keymap.map = @map.merge(other.map) keymap end end end
Version data entries
38 entries across 38 versions & 2 rubygems