Class: Expressir::Model::Declarations::Type

Inherits:
Expressir::Model::Declaration show all
Includes:
Identifier
Defined in:
lib/expressir/model/declarations/type.rb

Overview

Specified in ISO 10303-11:2004

  • section 9.1 Type declaration

Instance Attribute Summary collapse

Attributes included from Identifier

#id, #remark_items, #remarks, #source

Attributes inherited from ModelElement

#parent

Instance Method Summary collapse

Methods inherited from ModelElement

#children_by_id, #find, from_hash, model_attr_accessor, model_attrs, #path, #reset_children_by_id, #to_hash, #to_liquid, #to_s

Constructor Details

#initialize(options = {}) ⇒ Type

Returns a new instance of Type.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):



18
19
20
21
22
23
24
25
26
# File 'lib/expressir/model/declarations/type.rb', line 18

def initialize(options = {})
  initialize_identifier(options)

  @underlying_type = options[:underlying_type]
  @where_rules = options[:where_rules] || []
  @informal_propositions = options[:informal_propositions] || []

  super
end

Instance Attribute Details

#informal_propositionsArray<RemarkItem>

Returns:



11
# File 'lib/expressir/model/declarations/type.rb', line 11

model_attr_accessor :informal_propositions, "Array<RemarkItem>"

#underlying_typeDataType

Returns:



9
# File 'lib/expressir/model/declarations/type.rb', line 9

model_attr_accessor :underlying_type, "DataType"

#where_rulesArray<WhereRule>

Returns:



10
# File 'lib/expressir/model/declarations/type.rb', line 10

model_attr_accessor :where_rules, "Array<WhereRule>"

Instance Method Details

#childrenArray<Declaration>

Returns:



34
35
36
37
38
39
40
41
# File 'lib/expressir/model/declarations/type.rb', line 34

def children
  [
    *enumeration_items,
    *where_rules,
    *informal_propositions,
    *remark_items,
  ]
end

#enumeration_itemsArray<DataTypes::EnumerationItem>

Returns:



29
30
31
# File 'lib/expressir/model/declarations/type.rb', line 29

def enumeration_items
  underlying_type.is_a?(DataTypes::Enumeration) ? underlying_type.items : []
end