Sha256: a4456b69a81b3190682a67d43469d134cfbd570b3d20c92ab172789b1f2ccbb3

Contents?: true

Size: 742 Bytes

Versions: 29

Compression:

Stored size: 742 Bytes

Contents

class SID
  SID_S_RE = /\ASID__([a-zA-Z0-9:]+)__([\w\/\-]+)__\z/ # must use this way for compatiblity

  class << self
    def from_s(sid_s)
      m = SID_S_RE.match(sid_s)
      self.new(m[1], m[2]) if m
    end

    def is?(string)
      SID_S_RE.match?(string)
    end
  end

  attr_reader :class_name
  attr_reader :key

  if RUBY_ENGINE == 'opal'
    def initialize(class_name, key)
      @class_name = class_name
      @key = key
    end
  else
    def initialize(class_name, key)
      raise "Invalid class name '#{class_name}!" unless Isomorfeus.valid_data_class_name?(class_name)
      @class_name = class_name
      @key = key
    end
  end

  def to_s
    "SID__#{@class_name}__#{@key}__"
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
isomorfeus-data-23.9.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.9.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.8.0.rc3 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.8.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.8.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.7.0.rc5 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.7.0.rc4 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.7.0.rc3 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.7.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.7.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.6.0.rc5 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.6.0.rc4 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.6.0.rc3 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.6.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.6.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.1.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-23.1.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-22.11.0.rc1 lib/isomorfeus/data/sid.rb
isomorfeus-data-22.10.0.rc2 lib/isomorfeus/data/sid.rb
isomorfeus-data-22.10.0.rc1 lib/isomorfeus/data/sid.rb