Class: RubyCurses::Action

Inherits:
Proc
  • Object
show all
Includes:
ConfigSetup, EventHandler
Defined in:
lib/rbcurse/action.rb

Overview

encapsulates behaviour allowing centralization

Instance Method Summary collapse

Methods included from ConfigSetup

#cget, #config_setup, #configure, #variable_set

Methods included from EventHandler

#bind, #fire_handler, #fire_property_change

Constructor Details

#initialize(name, config = {}, &block) ⇒ Action

Returns a new instance of Action.



17
18
19
20
21
22
23
# File 'lib/rbcurse/action.rb', line 17

def initialize name, config={}, &block
  super &block
  @name = name
  @name.freeze
  @enabled = true
  config_setup config # @config.each_pair { |k,v| variable_set(k,v) }
end

Instance Method Details

#callObject



24
25
26
27
28
# File 'lib/rbcurse/action.rb', line 24

def call
  return unless @enabled
  fire_handler :FIRE, self
  super
end