Class: Codebeacon::Tracer::NodeSourceMapper
- Inherits:
-
Object
- Object
- Codebeacon::Tracer::NodeSourceMapper
- Defined in:
- lib/codebeacon/tracer/src/data/node_source_mapper.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(database) ⇒ NodeSourceMapper
constructor
A new instance of NodeSourceMapper.
- #insert(name, root_path) ⇒ Object
Constructor Details
#initialize(database) ⇒ NodeSourceMapper
Returns a new instance of NodeSourceMapper.
6 7 8 |
# File 'lib/codebeacon/tracer/src/data/node_source_mapper.rb', line 6 def initialize(database) @db = database end |
Class Method Details
.create_indexes(database) ⇒ Object
20 21 |
# File 'lib/codebeacon/tracer/src/data/node_source_mapper.rb', line 20 def self.create_indexes(database) end |
.create_table(database) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/codebeacon/tracer/src/data/node_source_mapper.rb', line 10 def self.create_table(database) database.execute <<-SQL CREATE TABLE IF NOT EXISTS node_sources ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, root_path TEXT NOT NULL ); SQL end |
Instance Method Details
#insert(name, root_path) ⇒ Object
23 24 25 26 |
# File 'lib/codebeacon/tracer/src/data/node_source_mapper.rb', line 23 def insert(name, root_path) @db.execute("INSERT INTO node_sources (name, root_path) VALUES (?, CAST(? AS TEXT))", [name, root_path]) @db.last_insert_row_id end |