Class: Pione::TupleSpace::TupleType
- Inherits:
-
PioneObject
- Object
- PioneObject
- Pione::TupleSpace::TupleType
- Defined in:
- lib/pione/tuple-space/basic-tuple.rb
Overview
TupleType represents tuple's field data type. TupleType has simple and complex form, the latter is consisted by types or-relation. The method +===+ is used by matching field data and type.
Instance Method Summary collapse
- #===(other) ⇒ Object private
-
#complex? ⇒ Boolean
Returns true if the type is complex.
-
#initialize(*types) ⇒ TupleType
constructor
Creates a tuple field type.
-
#simple? ⇒ Boolean
Returns true if the type is simple.
Constructor Details
#initialize(*types) ⇒ TupleType
Creates a tuple field type.
26 27 28 29 |
# File 'lib/pione/tuple-space/basic-tuple.rb', line 26 def initialize(*types) raise ArgumentError.new(types) unless types.size > 0 @types = types end |
Instance Method Details
#===(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/pione/tuple-space/basic-tuple.rb', line 46 def ===(other) @types.find {|t| t === other} end |
#complex? ⇒ Boolean
Returns true if the type is complex.
41 42 43 |
# File 'lib/pione/tuple-space/basic-tuple.rb', line 41 def complex? not(simple?) end |
#simple? ⇒ Boolean
Returns true if the type is simple.
34 35 36 |
# File 'lib/pione/tuple-space/basic-tuple.rb', line 34 def simple? @types.size == 1 end |