class SchemaCommentMatcher
Constants
- KEY_DELIM
Public Class Methods
enrich(columns)
click to toggle source
# File lib/schema_comment_matcher.rb, line 13 def self.enrich(columns) load_cache columns.each do |column| k = [column[:schema], column[:table], column[:column], column[:type]].join(KEY_DELIM) comment = @cache[k] if comment.present? column[:comment_text] = comment.text column[:comment_user_id] = comment.user_id column[:comment_id] = comment.id end end end
load_cache()
click to toggle source
# File lib/schema_comment_matcher.rb, line 4 def self.load_cache @cache = {} comments = SchemaComment.all comments.each do |comment| k = [comment.schema, comment.table, comment.column, comment.target_type].join(KEY_DELIM) @cache[k] = comment end end