Class: Copyable::SyntaxChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/copyable/syntax_checking/syntax_checker.rb

Class Method Summary collapse

Class Method Details

.check!(model_class, declaration_block) ⇒ Object

Raises:



4
5
6
7
8
9
10
11
12
# File 'lib/copyable/syntax_checking/syntax_checker.rb', line 4

def self.check!(model_class, declaration_block)
  raise CopyableError.new("You must pass copyable a block") if declaration_block.nil?
  declaration_checker = DeclarationChecker.new
  declaration_checker.verify!(declaration_block)
  column_checker = ColumnChecker.new(model_class)
  column_checker.verify!(declaration_block)
  association_checker = AssociationChecker.new(model_class)
  association_checker.verify!(declaration_block)
end