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,
lib/jade/frontend/type_checking/constraints/deriving/sql_mapper.rb

Defined Under Namespace

Modules: Decodable, Encodable, Eq, Helpers, SqlMapper

Constant Summary collapse

DERIVERS =
[Eq, Decodable, Encodable, SqlMapper]

Instance Method Summary collapse

Instance Method Details

#derivable?(interface) ⇒ Boolean

Returns:

  • (Boolean)


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

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

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



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

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