------ art_112_2936395.1322201455614
Content-Type: multipart/alternative;
boundary --- art_113_26984676.1322201455615"
------ art_113_26984676.1322201455615
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
"autoloading" can still be done by putting the require within a method that
is called only as needed.
The downside of this is that requires get pushed down into deeper levels of
code, making requirements less obvious to developers. Documentation not
withstanding, it's also not hard to work around. Just link us something
like:
$AUTOREQ ash.new{|h,k|h[k] }
def req(key, path)
$AUTOREQ[key.to_sym] << path
end
def use(key)
$AUTOREQ[key.to_sym].each{ |path| require path }
end
Then
req :rdoc, 'rdoc'
req :markdown, 'redcarpet'
class Tmpl
initialize(type)
use type
I'm sure this can be greatly improved upon, maybe even generalized (and
thread safe?) to make a useful library gem.
------ art_113_26984676.1322201455615
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
"autoloading" can still be done by putting the require within a method thats called only as needed.<div><br></div><div>The downside of this is that requires get pushed down into deeper levels of code, making requirements less obvious to developers. Documentation not withstanding, it's also not hard to work around. Just link us something like:</div><div><br></div><div> $AUTOREQ = Hash.new{|h,k|h[k]=[]}</div><div><br></div><div> def req(key, path)</div><div> $AUTOREQ[key.to_sym] << path</div><div> end</div><div><br></div><div> def use(key)</div><div> $AUTOREQ[key.to_sym].each{ |path| require path }</div><div> end</div><div><br></div><div>Then</div><div><br></div><div> req :rdoc, 'rdoc'</div><div> req :markdown, 'redcarpet'<br></div><div><br></div><div> class Tmpl</div><div> initialize(type)</div><div> use type</div><div><br></div><div>I'm sure this can be greatly improved upon, maybe even generalized (and thread safe?) to make a useful library gem.</div><div><br></div>
------ art_113_26984676.1322201455615--
------ art_112_2936395.1322201455614--