Class: MSF
- Inherits:
-
Object
- Object
- MSF
- Defined in:
- lib/msf/msf.rb
Overview
This class establishes an ActiveRecord connection to an MSF file (sqlite3 database) at the specified path.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
the resulting ActiveRecord::Base.connection.
-
#path ⇒ Object
filesystem PATH to an MSF file.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ MSF
constructor
msf.connection.tables msf.connection.disconnect! msf.reconnect.
-
#reconnect ⇒ Object
reconnect to the MSF file (sqlite3 database).
Constructor Details
#initialize(attributes = {}) ⇒ MSF
msf.connection.tables
msf.connection.disconnect!
msf.reconnect
22 23 24 25 26 27 |
# File 'lib/msf/msf.rb', line 22 def initialize(attributes={}) attributes.each do |name, value| send("#{name}=", value) end @connection = ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => @path).connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
the resulting ActiveRecord::Base.connection
9 10 11 |
# File 'lib/msf/msf.rb', line 9 def connection @connection end |
#path ⇒ Object
filesystem PATH to an MSF file
7 8 9 |
# File 'lib/msf/msf.rb', line 7 def path @path end |
Instance Method Details
#reconnect ⇒ Object
reconnect to the MSF file (sqlite3 database)
29 30 31 |
# File 'lib/msf/msf.rb', line 29 def reconnect @connection = ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => @path).connection end |