module Sequel::SQLComments
Public Instance Methods
comment(comment)
click to toggle source
Return a modified copy of the dataset that will use the given comment. To uncomment a commented dataset, pass nil as the argument.
# File lib/sequel/extensions/sql_comments.rb, line 97 def comment(comment) clone(:comment=>(format_sql_comment(comment) if comment)) end
Private Instance Methods
_sql_comment()
click to toggle source
The comment to include in the SQL query, if any.
# File lib/sequel/extensions/sql_comments.rb, line 129 def _sql_comment @opts[:comment] end
format_sql_comment(comment)
click to toggle source
Format the comment. For maximum compatibility, this uses a single line SQL comment, and converts all consecutive whitespace in the comment to a single space.
# File lib/sequel/extensions/sql_comments.rb, line 136 def format_sql_comment(comment) " -- #{comment.to_s.gsub(/\s+/, ' ')}\n" end