module Torque::PostgreSQL::Attributes::Builder
Public Class Methods
include_on(klass, method_name, builder_klass, **extra, &block)
click to toggle source
# File lib/torque/postgresql/attributes/builder.rb, line 10 def self.include_on(klass, method_name, builder_klass, **extra, &block) klass.define_singleton_method(method_name) do |*args, **options| return unless table_exists? args.each do |attribute| begin # Generate methods on self class builder = builder_klass.new(self, attribute, extra.merge(options)) builder.conflicting? builder.build # Additional settings for the builder instance_exec(builder, &block) if block.present? rescue Interrupt # Not able to build the attribute, maybe pending migrations end end end end