Sha256: f54de27f6c37aab7355b0b7a6169e1a10f56b944f8959b44099fe44a1bac21ba
Contents?: true
Size: 520 Bytes
Versions: 6
Compression:
Stored size: 520 Bytes
Contents
# $Id: style.rb 38 2007-08-27 13:03:39Z yuyakato $ require "rubygems" require "kagemusha" def one_plus_one return 1 + 1 end p one_plus_one #=> 2 # Normal Style. musha = Kagemusha.new(Fixnum) musha.def(:+) { 1 } musha.swap { p one_plus_one #=> 1 } p one_plus_one #=> 2 # Block Style. Kagemusha.new(Fixnum) { |m| m.def(:+) { 1 } m.swap { p one_plus_one #=> 1 } } p one_plus_one #=> 2 # Chain Style. Kagemusha.new(Fixnum). def(:+) { 1 }. swap { p one_plus_one #=> 1 } p one_plus_one #=> 2
Version data entries
6 entries across 6 versions & 1 rubygems