Module: RailsAiBridge::ExclusionHelper
- Defined in:
- lib/rails_ai_bridge/exclusion_helper.rb
Overview
Table name matching for +config.excluded_tables+ (exact names or +*+ globs).
Class Method Summary collapse
-
.table_pattern_match?(pattern, table_name) ⇒ Boolean
Returns +true+ when +table_name+ matches +pattern+ exactly or via +*+ glob.
Class Method Details
.table_pattern_match?(pattern, table_name) ⇒ Boolean
Returns +true+ when +table_name+ matches +pattern+ exactly or via +*+ glob. Table names in Rails are always lowercase snake_case, so matching is case-sensitive.
14 15 16 17 18 19 20 21 |
# File 'lib/rails_ai_bridge/exclusion_helper.rb', line 14 def table_pattern_match?(pattern, table_name) return false if pattern.to_s.empty? || table_name.to_s.empty? pat = pattern.to_s return pat == table_name unless pat.include?('*') File.fnmatch(pat, table_name, File::FNM_EXTGLOB) end |