Class: Expressir::Model::Declarations::Schema

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

Overview

Specified in ISO 10303-11:2004

  • section 9.3 Schema

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 = {}) ⇒ Schema

Returns a new instance of Schema.

Parameters:

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

Options Hash (options):



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/expressir/model/declarations/schema.rb', line 33

def initialize(options = {})
  @file = options[:file]

  initialize_identifier(options)

  @version = options[:version]
  @interfaces = options[:interfaces] || []
  @constants = options[:constants] || []
  @types = options[:types] || []
  @entities = options[:entities] || []
  @subtype_constraints = options[:subtype_constraints] || []
  @functions = options[:functions] || []
  @rules = options[:rules] || []
  @procedures = options[:procedures] || []

  super
end

Instance Attribute Details

#constantsArray<Constant>

Returns:



13
# File 'lib/expressir/model/declarations/schema.rb', line 13

model_attr_accessor :constants, "Array<Constant>"

#entitiesArray<Entity>

Returns:



15
# File 'lib/expressir/model/declarations/schema.rb', line 15

model_attr_accessor :entities, "Array<Entity>"

#fileString

Returns:



7
# File 'lib/expressir/model/declarations/schema.rb', line 7

model_attr_accessor :file, "String"

#functionsArray<Function>

Returns:



17
# File 'lib/expressir/model/declarations/schema.rb', line 17

model_attr_accessor :functions, "Array<Function>"

#interfacesArray<Interface>

Returns:



12
# File 'lib/expressir/model/declarations/schema.rb', line 12

model_attr_accessor :interfaces, "Array<Interface>"

#proceduresArray<Procedure>

Returns:



19
# File 'lib/expressir/model/declarations/schema.rb', line 19

model_attr_accessor :procedures, "Array<Procedure>"

#rulesArray<Rule>

Returns:



18
# File 'lib/expressir/model/declarations/schema.rb', line 18

model_attr_accessor :rules, "Array<Rule>"

#subtype_constraintsArray<SubtypeConstraint>

Returns:



16
# File 'lib/expressir/model/declarations/schema.rb', line 16

model_attr_accessor :subtype_constraints, "Array<SubtypeConstraint>"

#typesArray<Type>

Returns:



14
# File 'lib/expressir/model/declarations/schema.rb', line 14

model_attr_accessor :types, "Array<Type>"

#versionSchemaVersion

Returns:



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

model_attr_accessor :version, "SchemaVersion"

Instance Method Details

#childrenArray<Declaration>

Returns:



67
68
69
70
71
72
# File 'lib/expressir/model/declarations/schema.rb', line 67

def children
  [
    *interfaced_items,
    *safe_children,
  ]
end

#safe_childrenArray<Declaration>

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/expressir/model/declarations/schema.rb', line 52

def safe_children
  [
    *constants,
    *types,
    *types.flat_map(&:enumeration_items),
    *entities,
    *subtype_constraints,
    *functions,
    *rules,
    *procedures,
    *remark_items,
  ]
end