Module: Pubid::Omg

Extended by:
PrefixesSupport
Defined in:
lib/pubid/omg.rb,
lib/pubid/omg/parser.rb,
lib/pubid/omg/builder.rb,
lib/pubid/omg/renderer.rb,
lib/pubid/omg/identifier.rb,
lib/pubid/omg/identifiers.rb,
lib/pubid/omg/identifiers/specification.rb

Overview

OMG (Object Management Group) specification flavor.

Covers formal OMG specifications identified by an acronym (UML, SysML, CORBA, AMI4CCM, ...) with optional version (1.0, 2.5.1, 5 beta 3).

Defined Under Namespace

Modules: Identifiers Classes: Builder, Identifier, Parser, Renderer

Constant Summary collapse

PREFIXES =
["OMG"].freeze

Class Method Summary collapse

Methods included from PrefixesSupport

prefix_flavor_key, prefixes

Class Method Details

.all_typed_stagesObject



34
35
36
37
38
# File 'lib/pubid/omg.rb', line 34

def self.all_typed_stages
  @all_typed_stages ||= identifier_types.flat_map do |klass|
    klass.const_defined?(:TYPED_STAGES) ? klass.const_get(:TYPED_STAGES) : []
  end
end

.identifier_typesObject



27
28
29
30
31
32
# File 'lib/pubid/omg.rb', line 27

def self.identifier_types
  @identifier_types ||= Identifiers.constants
    .filter_map { |c| begin; Identifiers.const_get(c); rescue NameError; nil; end }
    .select { |c| c.is_a?(Class) && c.singleton_methods(false).include?(:type) }
    .select { |c| c.type.is_a?(Hash) }
end

.locate_stage(abbr) ⇒ Object



44
45
46
47
# File 'lib/pubid/omg.rb', line 44

def self.locate_stage(abbr)
  abbr_str = abbr.to_s.upcase
  all_typed_stages.find { |s| s.abbr.any? { |a| a.to_s.upcase == abbr_str } }
end

.locate_type(code) ⇒ Object



40
41
42
# File 'lib/pubid/omg.rb', line 40

def self.locate_type(code)
  identifier_types.find { |t| t.type[:key].to_s == code.to_s }
end

.parse(identifier) ⇒ Object



20
21
22
# File 'lib/pubid/omg.rb', line 20

def self.parse(identifier)
  Identifier.parse(identifier)
end