Skip to content

Instantly share code, notes, and snippets.

@jeremy
Created February 3, 2009 06:19
Show Gist options
  • Save jeremy/57346 to your computer and use it in GitHub Desktop.
Save jeremy/57346 to your computer and use it in GitHub Desktop.
$ irb
>> module M; protected; attr_reader :foo end
=> nil
>> class C; include M end
=> C
>> C.public_instance_methods.include?('foo')
=> false
$ jirb
>> module M; protected; attr_reader :foo end
=> nil
>> class C; include M end
=> C
>> C.public_instance_methods.include?('foo')
=> true
$ jirb
>> module N; def self.included(base) base.class_eval { attr_reader :bar; protected :bar } end end
=> nil
>> class C; include N end
=> C
>> C.public_instance_methods.include?('bar')
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment