Add events again
This commit is contained in:
parent
d891c2026e
commit
6c7a427780
2 changed files with 31 additions and 0 deletions
30
lib/events.rb
Normal file
30
lib/events.rb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Events
|
||||||
|
module Window
|
||||||
|
class Left; end
|
||||||
|
class Right; end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Text
|
||||||
|
class Left; end
|
||||||
|
class Right; end
|
||||||
|
class Up; end
|
||||||
|
class Down; end
|
||||||
|
class Home; end
|
||||||
|
class End; end
|
||||||
|
class Backspace; end
|
||||||
|
class Delete; end
|
||||||
|
|
||||||
|
class Putc
|
||||||
|
attr_reader :char
|
||||||
|
|
||||||
|
def initialize(char)
|
||||||
|
raise TypeError, "expected char to be a #{String}" unless char.is_a? String
|
||||||
|
raise ArgumentError, 'expected char to have length 1' unless char.length == 1
|
||||||
|
|
||||||
|
@char = char.frozen? ? char : char.dup.freeze
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,6 +3,7 @@
|
||||||
require 'curses'
|
require 'curses'
|
||||||
|
|
||||||
# Additional classes
|
# Additional classes
|
||||||
|
require 'events'
|
||||||
require 'style'
|
require 'style'
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
|
|
Reference in a new issue