ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ???????????????????????????????????? ???????????????????????????????????? ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ???????????????????????????????????? ???????????????????????????????????? U:RDoc::NormalClass[iI"SimpleDelegator:ET@I"Delegator;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"NA concrete implementation of Delegator, this class provides the means to ;TI"Sdelegate all supported method calls to the object passed into the constructor ;TI"Kand even to change the object being delegated to at a later time with ;TI"#__setobj__.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim;[I"class User ;TI" def born_on ;TI" Date.new(1989, 9, 10) ;TI" end ;TI" end ;TI" ;TI"require 'delegate' ;TI" ;TI"+class UserDecorator < SimpleDelegator ;TI" def birth_year ;TI" born_on.year ;TI" end ;TI" end ;TI" ;TI"2decorated_user = UserDecorator.new(User.new) ;TI")decorated_user.birth_year #=> 1989 ;TI"1decorated_user.__getobj__ #=> # ;T: @format0o; ;[I"TA SimpleDelegator instance can take advantage of the fact that SimpleDelegator ;TI"Sis a subclass of +Delegator+ to call super to have methods called on ;TI"#the object being delegated to.;T@o; ;[ I"(class SuperArray < SimpleDelegator ;TI" def [](*args) ;TI" super + 1 ;TI" end ;TI" end ;TI" ;TI"#SuperArray.new([1])[0] #=> 2 ;T; 0o; ;[I"CHere's a simple example that takes advantage of the fact that ;TI"DSimpleDelegator's delegation object can be changed at any time.;T@o; ;[I"class Stats ;TI" def initialize ;TI"+ @source = SimpleDelegator.new([]) ;TI" end ;TI" ;TI" def stats(records) ;TI"% @source.__setobj__(records) ;TI" ;TI"* "Elements: #{@source.size}\n" + ;TI"2 " Non-Nil: #{@source.compact.size}\n" + ;TI"- " Unique: #{@source.uniq.size}\n" ;TI" end ;TI" end ;TI" ;TI"s = Stats.new ;TI",puts s.stats(%w{James Edward Gray II}) ;TI" puts ;TI".puts s.stats([1, 2, 3, nil, 4, 5, 1, 2]) ;T; 0o; ;[I" Prints:;T@o; ;[ I"Elements: 4 ;TI" Non-Nil: 4 ;TI" Unique: 4 ;TI" ;TI"Elements: 8 ;TI" Non-Nil: 7 ;TI" Unique: 6;T; 0: @fileI"lib/delegate.rb;T:0@omit_headings_from_table_of_contents_below0; 0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[;[[I"__getobj__;TI"lib/delegate.rb;T[I"__setobj__;T@n[;[[;[[[U:RDoc::Context::Section[i0o;;[; 0;0[@Y@YcRDoc::TopLevel