class Mv::Core::Services::ShowConstraints
Attributes
tables[R]
Public Class Methods
new(tables)
click to toggle source
# File lib/mv/core/services/show_constraints.rb, line 11 def initialize(tables) @tables = tables.present? ? tables : Mv::Core::Db::MigrationValidator.pluck(:table_name) end
Public Instance Methods
execute()
click to toggle source
# File lib/mv/core/services/show_constraints.rb, line 15 def execute existing_constraints.each do |constraint| say_with_time("#{Mv::Core::Presenter::Constraint::Description.new(constraint.description)}") do constraint.validations.each do |validation| say("#{Mv::Core::Presenter::Validation::Base.new(validation)}") end end end end
Private Instance Methods
existing_constraints()
click to toggle source
# File lib/mv/core/services/show_constraints.rb, line 35 def existing_constraints Mv::Core::Services::LoadConstraints.new(tables).execute end
say(msg)
click to toggle source
# File lib/mv/core/services/show_constraints.rb, line 31 def say msg ::ActiveRecord::Migration::say(msg, true) end
say_with_time(msg, &block)
click to toggle source
# File lib/mv/core/services/show_constraints.rb, line 27 def say_with_time msg, &block ::ActiveRecord::Migration::say_with_time(msg, &block) end