manveru / ramaze

Ramaze is a simple, light and modular open-source web application framework written in Ruby.

This URL has Read+Write access

ramaze / lib / ramaze / snippets.rb
100644 23 lines (17 sloc) 0.648 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.
 
dir = File.join(File.expand_path(File.dirname(__FILE__)), 'snippets')
glob = File.join(dir, '**', '*.rb')
 
Dir[glob].each do |snippet|
  require(snippet)
end
 
Ramaze::CoreExtensions.constants.each do |const|
  ext = Ramaze::CoreExtensions.const_get(const)
  into = Module.const_get(const)
 
  collisions = ext.instance_methods & into.instance_methods
 
  if collisions.empty?
    into.__send__(:include, ext)
  else
    warn "Won't include %p with %p, %p exists" % [into, ext, collisions]
  end
end