Module: Archimate::DataModel::Elements

Defined in:
lib/archimate/data_model/elements.rb

Defined Under Namespace

Classes: AndJunction, ApplicationCollaboration, ApplicationComponent, ApplicationEvent, ApplicationFunction, ApplicationInteraction, ApplicationInterface, ApplicationProcess, ApplicationService, Artifact, Assessment, BusinessActor, BusinessCollaboration, BusinessEvent, BusinessFunction, BusinessInteraction, BusinessInterface, BusinessObject, BusinessProcess, BusinessRole, BusinessService, Capability, CommunicationNetwork, CommunicationPath, Constraint, Contract, CourseOfAction, DataObject, Deliverable, Device, DistributionNetwork, Driver, Equipment, Facility, Gap, Goal, Grouping, ImplementationEvent, InfrastructureFunction, InfrastructureInterface, InfrastructureService, Location, Material, Meaning, Network, Node, OrJunction, Outcome, Path, Plateau, Principle, Product, Representation, Requirement, Resource, Stakeholder, SystemSoftware, TechnologyCollaboration, TechnologyEvent, TechnologyFunction, TechnologyInteraction, TechnologyInterface, TechnologyObject, TechnologyProcess, TechnologyService, Value, WorkPackage

Class Method Summary collapse

Class Method Details

.===(other) ⇒ Object



791
792
793
# File 'lib/archimate/data_model/elements.rb', line 791

def self.===(other)
  constants.map(&:to_s).include?(str_filter(other))
end

.classesObject



801
802
803
# File 'lib/archimate/data_model/elements.rb', line 801

def self.classes
  constants.map { |cls_name| const_get(cls_name) }
end

.core_elementsObject



805
806
807
808
809
# File 'lib/archimate/data_model/elements.rb', line 805

def self.core_elements
  classes.select do |el|
    [Layers::Business, Layers::Application, Layers::Technology].include?(el::LAYER)
  end
end

.create(*args) ⇒ Object

Module Methods



783
784
785
786
787
788
789
# File 'lib/archimate/data_model/elements.rb', line 783

def self.create(*args)
  cls_name = str_filter(args[0].delete(:type))
  const_get(cls_name).new(*args)
rescue NameError => err
  Archimate::Logging.error "An invalid element type '#{cls_name}' was used to create an Element"
  raise err
end

.str_filter(str) ⇒ Object



795
796
797
798
799
# File 'lib/archimate/data_model/elements.rb', line 795

def self.str_filter(str)
  element_substitutions = {}.freeze
  cls_name = str.strip
  element_substitutions.fetch(cls_name, cls_name)
end