Class: Module::CompositeType
Direct Known Subclasses
ConjunctiveType, ContainerType, DisjunctiveType, EnumeratedType, NegativeType
Defined Under Namespace
Classes: Error
Constant Summary collapse
- CACHE =
{ }
- CACHE_MUTEX =
Mutex.new
Instance Attribute Summary collapse
-
#_t ⇒ Object
readonly
Returns the value of attribute _t.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(types) ⇒ CompositeType
constructor
A new instance of CompositeType.
- #name ⇒ Object
Methods inherited from Module
Constructor Details
#initialize(types) ⇒ CompositeType
Returns a new instance of CompositeType.
17 18 19 20 |
# File 'lib/composite_type.rb', line 17 def initialize types raise Error, "cannot create CompositeType from unamed object" unless types.all?{|x| x.name} @_t = types end |
Instance Attribute Details
#_t ⇒ Object (readonly)
Returns the value of attribute _t.
21 22 23 |
# File 'lib/composite_type.rb', line 21 def _t @_t end |
Class Method Details
.new_cached(*types) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/composite_type.rb', line 7 def self.new_cached *types key = [ self, types ] (Thread.current[:'Module::CompositeType.cache'] ||= { })[key] ||= CACHE_MUTEX.synchronize do CACHE[key] ||= new(types) end end |
Instance Method Details
#name ⇒ Object
22 |
# File 'lib/composite_type.rb', line 22 def name; to_s; end |