104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# File 'lib/uttk.rb', line 104
def uttk_module
module_eval do
UTTK_MODULES << self
def self.module_dirs
mod = name.demodulize.underscore
Uttk.load_path.map { |path| path/mod }
end
def self.setup_autoload
module_dirs.each do |module_dir|
if module_dir.directory? and module_dir.readable? and module_dir.executable?
autoload_tree(module_dir, false) do |p|
Uttk.pathname_to_class(p)
end
end
end
end
setup_autoload
def self.define_module
module_dirs.each do |module_dir|
def_file = Pathname.new("#{module_dir}.rb")
if def_file.readable?
require def_file.to_s
end
end
end
define_module
def self.each_module_name ( &block )
Pathname.glob('{' + module_dirs.join(',') + '}/**/*.rb') do |path|
block[path.basename.ext.to_s.to_sym]
end
end
end
end
|