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, Junction, 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



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

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

.classesObject



812
813
814
# File 'lib/archimate/data_model/elements.rb', line 812

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

.core_elementsObject



816
817
818
819
820
# File 'lib/archimate/data_model/elements.rb', line 816

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

.create(*args) ⇒ Object

Module Methods



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

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



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

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