Class: Type::Definition::Collection
- Inherits:
-
Object
- Object
- Type::Definition::Collection
show all
- Includes:
- Type::Definition
- Defined in:
- lib/type/definition/collection.rb,
lib/type/definition/collection/constrained.rb
Overview
Re-open Collection to add constraint methods
Defined Under Namespace
Classes: Constrained
Instance Attribute Summary
#name
Instance Method Summary
collapse
included, #initialize, #nilable, #nilable?, #refine, #to_proc, #to_s
Instance Method Details
#cast!(input, &block) ⇒ Object
25
26
27
28
|
# File 'lib/type/definition/collection.rb', line 25
def cast!(input, &block)
raise CastError.new(input, self) unless input.kind_of?(Enumerable)
super
end
|
#constrain(constraint) ⇒ Type::Defintion::Collection::Constrained
#constrain(constraint) ⇒ Type::Defintion::Collection::Constrained
Also known as:
of
14
15
16
|
# File 'lib/type/definition/collection/constrained.rb', line 14
def constrain(constraint)
Constrained.new(self, constraint)
end
|
#constrained? ⇒ False
20
21
22
|
# File 'lib/type/definition/collection/constrained.rb', line 20
def constrained?
false
end
|
#valid?(input, *args, &block) ⇒ Boolean
20
21
22
23
|
# File 'lib/type/definition/collection.rb', line 20
def valid?(input, *args, &block)
return false unless input.kind_of?(Enumerable)
super
end
|