Skip to content

Use code generation for inlining #150

Closed
@robnormal

Description

@robnormal

The Contract class has been heavily inlined, with results in much of the code being closed for modification. I cannot subclass Contract and redefine how it handles Class contracts, for example, without rewriting an entirely new make_validator method.

Why not generate contracts.rb with ERB or other templating solution instead? That would allow the code to be broken down as it should be for maintainability, without sacrificing performance. (In particular, it would allow extending or monkeypatching Contract to play nicely with RSpec, rather than modifying RSpec itself, as in contracts-rspec.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions