Module: Cuboid::Support::Mixins::Observable

Includes:
UI::Output, Utilities, MonitorMixin
Included in:
Application, Buffer::Base
Defined in:
lib/cuboid/support/mixins/observable.rb

Overview

Provides a flexible way to make any object observable for multiple events.

The observable classes use:

* `notify_<event>( *args )`

to notify observers of events.

The observers request notifications using:

* `observable.<event>( &block )`

Author:

  • Tasos “Zapotek” Laskos <tasos.laskos@gmail.com>

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#available_port, available_port_mutex, #bytes_to_kilobytes, #bytes_to_megabytes, #caller_name, #caller_path, #exception_jail, #generate_token, #hms_to_seconds, #port_available?, #rand_port, #random_seed, #regexp_array_match, #remove_constants, #seconds_to_hms

Methods included from UI::Output

#error_buffer, initialize, #log_error, #output_provider_file, #print_bad, #print_debug, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?

Methods included from UI::OutputInterface

initialize

Methods included from UI::OutputInterface::Personalization

#included

Methods included from UI::OutputInterface::Controls

#debug?, #debug_level, #debug_level_1?, #debug_level_2?, #debug_level_3?, #debug_level_4?, #debug_off, #debug_on, initialize, #verbose?, #verbose_off, #verbose_on

Methods included from UI::OutputInterface::ErrorLogging

#error_logfile, #has_error_log?, initialize, #set_error_logfile

Methods included from UI::OutputInterface::Implemented

#print_debug_backtrace, #print_debug_exception, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_debug_level_4, #print_error_backtrace, #print_exception

Methods included from UI::OutputInterface::Abstract

#output_provider_file, #print_bad, #print_debug, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose

Class Method Details

.included(base) ⇒ Object



24
25
26
# File 'lib/cuboid/support/mixins/observable.rb', line 24

def self.included( base )
    base.extend ClassMethods
end

Instance Method Details

#initializeObject



46
47
48
49
50
# File 'lib/cuboid/support/mixins/observable.rb', line 46

def initialize
    super

    @__observers = {}
end