8. cocoa = ruby_on_rails if you.online?
cocoa = ruby_libraries if you.skool == old
cocoa = j2ee if you.wear?(suits)
cocoa = dot_net if you.evil?
cocoa.analogy.to_s
47. Cocoa vs. Ruby
wordy expressive
initWithContentRect:style
game.bets.last.valid?
Mask:backing:defer:scree
n:
48. Cocoa vs. Ruby
wordy expressive
initWithContentRect:style
game.bets.last.valid?
Mask:backing:defer:scree
n:
49. HotCocoa::Mapping.map(:button => :NSButton) do
def init_with_options(button, options)
button.initWithFrame options.delete(:frame)
end
end
require 'hotcocoa'
include HotCocoa
button :frame => [0,0,20,100]
HotCocoa Constructors
50. HotCocoa::Mapping.map(:button => :NSButton) do
defaults :bezel => :rounded,
:frame => DefaultEmptyRect,
:layout => {}
end
require 'hotcocoa'
include HotCocoa
b = button
HotCocoa Defaults
51. HotCocoa::Mapping.map(:button => :NSButton) do
constant :state, {
:on => NSOnState,
:o = NSOState,
:mixed = NSMixedState
}
end
require 'hotcocoa'
include HotCocoa
button :state = :on
HotCocoa Constants
52. HotCocoa::Mapping.map(:button = :NSButton) do
custom_methods do
def bezel=(value)
setBezelStyle(value)
end
def on?
state == NSOnState
end
end
end
require 'hotcocoa'
include HotCocoa
go_button = button :state = on
puts 'yeah!' if go_button.on?
HotCocoa Methods