Class: Coolline::Handler

Inherits:
Struct
  • Object
show all
Defined in:
lib/coolline/handler.rb

Overview

A handler is a simple object used to match keys.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(char, &block) ⇒ Handler

Returns a new instance of Handler.



5
6
7
# File 'lib/coolline/handler.rb', line 5

def initialize(char, &block)
  old_initialize(char, block)
end

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



3
4
5
# File 'lib/coolline/handler.rb', line 3

def block
  @block
end

#charObject

Returns the value of attribute char

Returns:

  • (Object)

    the current value of char



3
4
5
# File 'lib/coolline/handler.rb', line 3

def char
  @char
end

Instance Method Details

#===(other_char) ⇒ Object



9
10
11
# File 'lib/coolline/handler.rb', line 9

def ===(other_char)
  char === other_char
end

#call(cool) ⇒ Object



13
14
15
# File 'lib/coolline/handler.rb', line 13

def call(cool)
  block.call(cool)
end

#old_initializeObject



4
# File 'lib/coolline/handler.rb', line 4

alias old_initialize initialize