Sha256: 0db470cf75ce164e146a3649463d21fd4f45b7497cce85a4f4983f54caa2bf99
Contents?: true
Size: 351 Bytes
Versions: 6
Compression:
Stored size: 351 Bytes
Contents
module FactoryBot class << self attr_accessor :aliases end self.aliases = [ [/(.+)_id/, '\1'], [/(.*)/, '\1_id'] ] def self.aliases_for(attribute) aliases.map do |(pattern, replace)| if pattern.match(attribute.to_s) attribute.to_s.sub(pattern, replace).to_sym end end.compact << attribute end end
Version data entries
6 entries across 6 versions & 1 rubygems