Module: Marginalia::Comment
- Defined in:
- lib/marginalia/comment.rb
Class Method Summary collapse
- .clear! ⇒ Object
- .clear_job! ⇒ Object
- .construct_comment ⇒ Object
- .escape_sql_comment(str) ⇒ Object
- .update!(controller = nil) ⇒ Object
- .update_adapter!(adapter) ⇒ Object
- .update_job!(job) ⇒ Object
Class Method Details
.clear! ⇒ Object
40 41 42 |
# File 'lib/marginalia/comment.rb', line 40 def self.clear! self.marginalia_controller = nil end |
.clear_job! ⇒ Object
44 45 46 |
# File 'lib/marginalia/comment.rb', line 44 def self.clear_job! self.marginalia_job = nil end |
.construct_comment ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/marginalia/comment.rb', line 20 def self.construct_comment ret = '' self.components.each do |c| component_value = self.send(c) if component_value.present? ret << "#{c.to_s}:#{component_value.to_s}," end end ret.chop! ret = self.escape_sql_comment(ret) ret end |
.escape_sql_comment(str) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/marginalia/comment.rb', line 33 def self.escape_sql_comment(str) while str.include?('/*') || str.include?('*/') str = str.gsub('/*', '').gsub('*/', '') end str end |
.update!(controller = nil) ⇒ Object
8 9 10 |
# File 'lib/marginalia/comment.rb', line 8 def self.update!(controller = nil) self.marginalia_controller = controller end |
.update_adapter!(adapter) ⇒ Object
16 17 18 |
# File 'lib/marginalia/comment.rb', line 16 def self.update_adapter!(adapter) self.marginalia_adapter = adapter end |
.update_job!(job) ⇒ Object
12 13 14 |
# File 'lib/marginalia/comment.rb', line 12 def self.update_job!(job) self.marginalia_job = job end |