Class: Alf::Engine::TypeSafe
- Inherits:
-
Object
- Object
- Alf::Engine::TypeSafe
- Includes:
- Cog
- Defined in:
- lib/alf/engine/type_safe.rb
Constant Summary
Constants included from Cog
Cog::EMPTY_CHILDREN, Cog::EMPTY_OPTIONS
Instance Attribute Summary collapse
-
#checker ⇒ TypeChecker
readonly
Type checker to use.
-
#operand ⇒ Enumerable
readonly
The operand.
Attributes included from Compiler::Cog
Instance Method Summary collapse
- #_each ⇒ Object
-
#initialize(operand, checker, expr = nil, compiler = nil) ⇒ TypeSafe
constructor
Creates an Coerce instance.
Methods included from Cog
#arguments, #children, #each, #options, #to_s
Methods included from Compiler::Cog
#cog_orders, #orderedby?, #relation_type, #to_ascii_tree, #to_cog, #to_relation
Constructor Details
#initialize(operand, checker, expr = nil, compiler = nil) ⇒ TypeSafe
Creates an Coerce instance
13 14 15 16 17 |
# File 'lib/alf/engine/type_safe.rb', line 13 def initialize(operand, checker, expr = nil, compiler = nil) super(expr, compiler) @operand = operand @checker = checker end |
Instance Attribute Details
#checker ⇒ TypeChecker (readonly)
Returns Type checker to use.
10 11 12 |
# File 'lib/alf/engine/type_safe.rb', line 10 def checker @checker end |
#operand ⇒ Enumerable (readonly)
Returns The operand.
7 8 9 |
# File 'lib/alf/engine/type_safe.rb', line 7 def operand @operand end |
Instance Method Details
#_each ⇒ Object
20 21 22 23 24 25 |
# File 'lib/alf/engine/type_safe.rb', line 20 def _each @operand.each do |tuple| raise TypeCheckError, "Invalid tuple `#{tuple.inspect}`" unless checker===tuple yield(tuple) end end |