Sha256: 024d012b20581373cc7942ecea318420a4b71ffc8bb7bb02de0e1d96877f4aef

Contents?: true

Size: 710 Bytes

Versions: 37

Compression:

Stored size: 710 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)
      keymap.map = @map.merge(other.map)
      keymap
    end
  end
end
 

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
redcar-0.9.2 plugins/application/lib/application/keymap.rb
redcar-0.9.1 plugins/application/lib/application/keymap.rb
redcar-0.9.0 plugins/application/lib/application/keymap.rb
redcar-0.8.1 plugins/application/lib/application/keymap.rb
redcar-0.8 plugins/application/lib/application/keymap.rb
redcar-0.7 plugins/application/lib/application/keymap.rb
redcar-0.6.1 plugins/application/lib/application/keymap.rb
redcar-0.6 plugins/application/lib/application/keymap.rb
redcar-0.6.1dev plugins/application/lib/application/keymap.rb
redcar-0.5.1 plugins/application/lib/application/keymap.rb
redcar-0.5 plugins/application/lib/application/keymap.rb
redcar-0.5.6dev plugins/application/lib/application/keymap.rb
redcar-0.5.5dev plugins/application/lib/application/keymap.rb
redcar-0.5.4dev plugins/application/lib/application/keymap.rb
redcar-0.5.3dev plugins/application/lib/application/keymap.rb
redcar-0.5.2dev plugins/application/lib/application/keymap.rb
redcar-0.5.1dev plugins/application/lib/application/keymap.rb
redcar-0.4.1 plugins/application/lib/application/keymap.rb
redcar-0.4 plugins/application/lib/application/keymap.rb
redcar-0.3.10.1dev plugins/application/lib/application/keymap.rb