Module: Jade::Frontend::TypeChecking::Constraints::Deriving

Extended by:
Deriving
Included in:
Deriving
Defined in:
lib/jade/frontend/type_checking/constraints/deriving.rb,
lib/jade/frontend/type_checking/constraints/deriving/eq.rb,
lib/jade/frontend/type_checking/constraints/deriving/helpers.rb,
lib/jade/frontend/type_checking/constraints/deriving/decodable.rb,
lib/jade/frontend/type_checking/constraints/deriving/encodable.rb

Defined Under Namespace

Modules: Decodable, Encodable, Eq, Helpers

Constant Summary collapse

DERIVERS =
[Eq, Decodable, Encodable]

Instance Method Summary collapse

Instance Method Details

#derivable?(interface) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/jade/frontend/type_checking/constraints/deriving.rb', line 15

def derivable?(interface)
  DERIVERS.any? { it.supports?(interface) }
end

#derive(constraint, registry, entry_name, &lookup) ⇒ Object



19
20
21
22
23
# File 'lib/jade/frontend/type_checking/constraints/deriving.rb', line 19

def derive(constraint, registry, entry_name, &lookup)
  DERIVERS
    .find { it.supports?(constraint.interface) }
    .then { it.derive(constraint, registry, entry_name, &lookup) }
end