Class: Orchestrate::Application::SchemaCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestrate_application/schema_collection.rb

Overview

Schema support object.

Direct Known Subclasses

Rails::SchemaCollection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) {|_self| ... } ⇒ SchemaCollection

args: { :name, :properties, :event_types, :graphs }

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/orchestrate_application/schema_collection.rb', line 10

def initialize(args)
  @name, @properties = args[:name], args[:properties] + [:id]

  @event_types = {}
  if args[:event_types]
    args[:event_types].each { |etype| @event_types[etype] = etype }
  end

  @graphs = {}
  if args[:graphs]
    args[:graphs].each { |kind| @graphs[kind] = kind }
  end

  yield self if block_given?
end

Instance Attribute Details

#event_typesObject (readonly)

Returns the value of attribute event_types.



6
7
8
# File 'lib/orchestrate_application/schema_collection.rb', line 6

def event_types
  @event_types
end

#graphsObject (readonly)

Returns the value of attribute graphs.



6
7
8
# File 'lib/orchestrate_application/schema_collection.rb', line 6

def graphs
  @graphs
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/orchestrate_application/schema_collection.rb', line 6

def name
  @name
end

#propertiesObject (readonly)

Returns the value of attribute properties.



6
7
8
# File 'lib/orchestrate_application/schema_collection.rb', line 6

def properties
  @properties
end

Instance Method Details

#define_event_type(event_type, properties) ⇒ Object



26
27
28
# File 'lib/orchestrate_application/schema_collection.rb', line 26

def define_event_type(event_type, properties)
 @event_types[event_type] = SchemaEventType.new(event_type, properties)
end

#define_graph(relation_kind, to_collection) ⇒ Object



30
31
32
# File 'lib/orchestrate_application/schema_collection.rb', line 30

def define_graph(relation_kind, to_collection)
  @graphs[relation_kind] = SchemaGraph.new(relation_kind, to_collection)
end