Module: Avm::Instances::Ids

Defined in:
lib/avm/instances/ids.rb

Constant Summary collapse

ID_PARTS_SEPARATOR =
'_'
ID_PATTERN =
/\A([a-z0-9]+(?:\-[a-z0-9]+)*)_(.+)\z/.freeze
ID_PARSER =
ID_PATTERN.to_parser do |m|
  ::Struct.new(:application_id, :instance_suffix).new(m[1], m[2])
end

Class Method Summary collapse

Class Method Details

.build(application_id, instance_suffix) ⇒ String

Parameters:

  • application_id (String)
  • instance_suffix (String)

Returns:

  • (String)


18
19
20
# File 'lib/avm/instances/ids.rb', line 18

def build(application_id, instance_suffix)
  [application_id, instance_suffix].join(ID_PARTS_SEPARATOR)
end

.parse!(id) ⇒ String

Parameters:

  • id (String)

Returns:

  • (String)


24
25
26
# File 'lib/avm/instances/ids.rb', line 24

def parse!(id)
  ID_PARSER.parse!(id)
end