Class: ServiceOperation::Params::EnumerableOf
- Defined in:
- lib/service_operation/params/types.rb
Overview
Matches an Enumerable with specific sub types
Direct Known Subclasses
Instance Attribute Summary collapse
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
Instance Method Summary collapse
- #===(other) ⇒ Boolean
-
#initialize(*args) ⇒ EnumerableOf
constructor
A new instance of EnumerableOf.
- #name ⇒ Object
- #type ⇒ Object
Methods inherited from EnumType
Constructor Details
#initialize(*args) ⇒ EnumerableOf
Returns a new instance of EnumerableOf.
75 76 77 78 79 |
# File 'lib/service_operation/params/types.rb', line 75 def initialize(*args) @element_type = args.length == 1 ? args.first : Any.new(args) super end |
Instance Attribute Details
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
73 74 75 |
# File 'lib/service_operation/params/types.rb', line 73 def element_type @element_type end |
Instance Method Details
#===(other) ⇒ Boolean
82 83 84 |
# File 'lib/service_operation/params/types.rb', line 82 def ===(other) type === other && other.all? { |element| element_type === element } end |
#name ⇒ Object
86 87 88 |
# File 'lib/service_operation/params/types.rb', line 86 def name "#{super}Of(#{element_type.name})" end |
#type ⇒ Object
90 91 92 |
# File 'lib/service_operation/params/types.rb', line 90 def type Enumerable end |