Class: Copyable::CompletenessChecker
- Inherits:
-
Object
- Object
- Copyable::CompletenessChecker
- Includes:
- DeclarationStubber
- Defined in:
- lib/copyable/syntax_checking/completeness_checker.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(model_class) ⇒ CompletenessChecker
constructor
A new instance of CompletenessChecker.
-
#verify!(block) ⇒ Object
an algorithm for ensuring that the expected entries are listed in a declaration – no more, and no less.
Methods included from DeclarationStubber
Constructor Details
#initialize(model_class) ⇒ CompletenessChecker
Returns a new instance of CompletenessChecker.
6 7 8 |
# File 'lib/copyable/syntax_checking/completeness_checker.rb', line 6 def initialize(model_class) @model_class = model_class end |
Instance Method Details
#verify!(block) ⇒ Object
an algorithm for ensuring that the expected entries are listed in a declaration – no more, and no less
12 13 14 15 16 17 18 19 20 |
# File 'lib/copyable/syntax_checking/completeness_checker.rb', line 12 def verify!(block) self.instance_eval(&block) expected = Set.new(expected_entries) provided = Set.new(provided_entries) missing_entries = expected - provided extra_entries = provided - expected missing_entries_found(missing_entries) if missing_entries.any? extra_entries_found(extra_entries) if extra_entries.any? end |