Module: By2
- Defined in:
- lib/by2.rb,
lib/by2/utils.rb,
lib/by2/client.rb,
lib/by2/options.rb,
lib/by2/version.rb,
lib/by2/models/event.rb,
lib/by2/models/iphdr.rb,
lib/by2/config_loader.rb,
lib/by2/models/tcphdr.rb,
lib/by2/models/udphdr.rb,
lib/by2/models/icmphdr.rb,
lib/by2/models/payload.rb
Defined Under Namespace
Modules: Models, Utils
Classes: Client, ConfigLoader, Options
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
23
24
25
|
# File 'lib/by2.rb', line 23
def self.config
@config ||= ConfigLoader.new
end
|
.db_connect ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/by2.rb', line 31
def self.db_connect
@conn ||= begin
conn_config = config.load("database.yml")
ActiveRecord::Base.default_timezone = :local
ActiveRecord::Base.establish_connection(conn_config[env])
ActiveRecord::Base.connection
ActiveRecord::Base.logger = Logger.new(STDOUT) if debug?
end
end
|
.debug(msg) ⇒ Object
54
55
56
|
# File 'lib/by2.rb', line 54
def self.debug(msg)
$stdout.puts(msg) if debug?
end
|
.debug=(d) ⇒ Object
50
51
52
|
# File 'lib/by2.rb', line 50
def self.debug=(d)
@debug = d
end
|
.debug? ⇒ Boolean
46
47
48
|
# File 'lib/by2.rb', line 46
def self.debug?
@debug ||= false
end
|
.env ⇒ Object
42
43
44
|
# File 'lib/by2.rb', line 42
def self.env
@env ||= (ENV['BY2_ENV'] || config.load("env.yml", false) || "development")
end
|
.fixtures_dir ⇒ Object
27
28
29
|
# File 'lib/by2.rb', line 27
def self.fixtures_dir
File.join(root, "spec", "fixtures")
end
|
.root ⇒ Object
19
20
21
|
# File 'lib/by2.rb', line 19
def self.root
@root ||= File.expand_path(File.join(__FILE__, '..', '..'))
end
|