Class: RubyPgExtras::IgnoreList
- Inherits:
-
Object
- Object
- RubyPgExtras::IgnoreList
- Defined in:
- lib/ruby_pg_extras/ignore_list.rb
Overview
Parses and matches ignore patterns like:
-
“*” (ignore everything)
-
“posts.*” (ignore all columns on a table)
-
“category_id” (ignore this column name on all tables)
-
“posts.topic_id” (ignore a specific table+column)
Instance Method Summary collapse
- #ignored?(table:, column_name:) ⇒ Boolean
-
#initialize(ignore_list) ⇒ IgnoreList
constructor
A new instance of IgnoreList.
Constructor Details
#initialize(ignore_list) ⇒ IgnoreList
Returns a new instance of IgnoreList.
10 11 12 |
# File 'lib/ruby_pg_extras/ignore_list.rb', line 10 def initialize(ignore_list) @rules = normalize(ignore_list) end |
Instance Method Details
#ignored?(table:, column_name:) ⇒ Boolean
14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby_pg_extras/ignore_list.rb', line 14 def ignored?(table:, column_name:) @rules.any? do |rule| next true if rule == "*" next true if rule == "#{table}.*" next true if rule == column_name next true if rule == "#{table}.#{column_name}" false end end |