Sha256: 35fa34fc3930c19cd1f9600405df2445c252dca3a06091e3a4706bfbbd0b2be2
Contents?: true
Size: 561 Bytes
Versions: 2
Compression:
Stored size: 561 Bytes
Contents
= Instantiable Require the library. require 'mixers/instantiable' We will use this module as an example. module M include Instantiable attr :a def initialize(a) @a = a end end As we can see M is now fully instantiable, as any class would be. m = M.new(1) m.a.assert == 1 We can also use #extend rather than #include and get the same result. module N extend Instantiable attr :a def initialize( a ) @a = a end end As we saw with +M+ so too with +N+. n = N.new( 1 ) n.a.assert == 1
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mixers-1.2.0 | qed/05_instantiable.rdoc |
mixers-1.1.0 | qed/05_instantiable.rdoc |