Class: SqlFootprint::SqlCapturer
- Inherits:
-
Object
- Object
- SqlFootprint::SqlCapturer
- Defined in:
- lib/sql_footprint/sql_capturer.rb
Instance Attribute Summary collapse
-
#database_name ⇒ Object
readonly
Returns the value of attribute database_name.
-
#statements ⇒ Object
readonly
Returns the value of attribute statements.
Instance Method Summary collapse
- #capture(sql) ⇒ Object
-
#initialize(database_name) ⇒ SqlCapturer
constructor
A new instance of SqlCapturer.
- #write ⇒ Object
Constructor Details
#initialize(database_name) ⇒ SqlCapturer
Returns a new instance of SqlCapturer.
7 8 9 10 11 12 |
# File 'lib/sql_footprint/sql_capturer.rb', line 7 def initialize database_name @anonymizer = SqlAnonymizer.new @filter = SqlFilter.new @statements = SqlStatements.new @database_name = database_name end |
Instance Attribute Details
#database_name ⇒ Object (readonly)
Returns the value of attribute database_name.
5 6 7 |
# File 'lib/sql_footprint/sql_capturer.rb', line 5 def database_name @database_name end |
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
5 6 7 |
# File 'lib/sql_footprint/sql_capturer.rb', line 5 def statements @statements end |
Instance Method Details
#capture(sql) ⇒ Object
14 15 16 17 |
# File 'lib/sql_footprint/sql_capturer.rb', line 14 def capture sql return unless @filter.capture?(sql) @statements.add @anonymizer.anonymize(sql) end |
#write ⇒ Object
19 20 21 |
# File 'lib/sql_footprint/sql_capturer.rb', line 19 def write File.write filename, serialized_statements end |