Module: HotCocoa::Behaviors

Included in:
NSURL
Defined in:
lib/hotcocoa/behaviors.rb

Overview

A mixin module for classes that subclass Cocoa classes and want to also inherit HotCocoa customizations (custom methods, constants, etc.)

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Implements the callback Module#included; this method declares that when HotCocoa::Behaviors is mixed in to a class that the class mixing in HotCocoa::Behaviors will gain all the HotCocoa customizations made to its superclasses.

Examples:


# Without including, you cannot call HotCocoa custom methods
class CustomView < NSView
  def begin
    enter_full_screen # => NoMethodError
  end
end

# HotCocoa custom methods work when you inculde HotCocoa::Behaviors
class OtherCustomView < NSView
  include HotCocoa::Behaviors

  def begin
    enter_full_screen # => goes full screen
  end
end


30
31
32
# File 'lib/hotcocoa/behaviors.rb', line 30

def self.included klass
  HotCocoa::Mappings::Mapper.map_class klass
end