Top Level Namespace
Defined Under Namespace
Modules: ActiveRecord, Clevic, DocumentEvent, Java, Kernel, Qt, Sequel, Ui
Classes: AbstractButton, Array, BlockRunner, CaretEvent, Class, Component, EventObject, ItemEvent, JComboBox, JObject, JTabbedPane, KeyEvent, KeyStroke, ModelColumn, MouseEvent, Object, String, TableModelEvent, Ui_Browser, Ui_SearchDialog
Constant Summary
collapse
- OrderedHash =
Hash
- SwingUtilities =
javax.swing.SwingUtilities
Instance Method Summary
collapse
Instance Method Details
91
92
93
|
# File 'lib/clevic/extensions.rb', line 91
def distance
last - first
end
|
#load_rails_models(root, config, models) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/clevic/rails_models_loaders.rb', line 16
def load_rails_models( root, config, models )
load config / 'environment.rb'
require 'initializer.rb'
Rails::Initializer.run do |config|
config.frameworks -= [ :action_mailer, :action_pack, :active_resource ]
end
$: << ( root / 'lib' ).realpath.to_s
( root / 'lib' ).children.each do |filename|
load filename if filename.file?
end
begin
ActiveRecord::Dirty
rescue NameError
ActiveRecord::Base.send(:include, ActiveRecord::Dirty)
end
models.find do |dir_entry|
next unless dir_entry.file?
next unless dir_entry.basename.to_s =~ /\.rb$/
begin
load dir_entry
rescue Exception => e
puts "Error loading #{dir_entry.basename.to_s}: #{e.message}"
puts e.backtrace
end
end
subclasses( Clevic.base_entity_class ).each do |model|
if model.table_exists?
model.send :include, Clevic::Record unless model.abstract_class?
end
end
end
|
#maybe_load_rails_models ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/clevic/rails_models_loaders.rb', line 60
def maybe_load_rails_models
config = pathname / 'config'
app = pathname / 'app'
models = app / 'models'
if config.exist? && app.exist? && models.exist?
load_rails_models( pathname, config, models )
end
end
|
90
91
92
93
94
|
# File 'lib/clevic/extensions.rb', line 90
def Range
def distance
last - first
end
end
|
#subclasses(base) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/clevic/rails_models_loaders.rb', line 3
def subclasses( base )
classes = []
ObjectSpace.each_object( Class ) do |x|
if x.ancestors.include?( base )
case
when x == Clevic.base_entity_class; else; classes << x
end
end
end
classes.sort{|a,b| a.name <=> b.name}
end
|