Class: NetSystem::Record
Class Method Summary
collapse
color, on_connected
Methods inherited from Liza::Unit
const_missing, division, part, system, #system, test_class
Class Method Details
.db(database_id = nil) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/net_system/sub/record/record.rb', line 11
def self.db database_id = nil
if database_id.nil?
db = get :db
if db
NetBox[:database].get(db)
else
raise "please set a db to record #{self}"
end
else
valid = NetBox[:database].settings.keys
if valid.include? database_id
set :db, database_id
else
raise "invalid db `#{database_id}`, valid options are #{valid}"
end
end
end
|
.inherited(sub) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/net_system/sub/record/record.rb', line 3
def self.inherited sub
super
return if sub.name.nil?
return if sub.name.end_with? "Record"
raise "please rename #{sub.name} to #{sub.name}Record"
end
|