Class: Lite::Uxid::Reversible::Base

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/lite/uxid/reversible/base.rb

Direct Known Subclasses

Hashid, Obfuscateid

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#decode, #encode

Constructor Details

#initialize(id, opts = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/lite/uxid/reversible/base.rb', line 12

def initialize(id, opts = {})
  @id = id
  @opts = opts
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/lite/uxid/reversible/base.rb', line 10

def id
  @id
end

#optsObject (readonly)

Returns the value of attribute opts.



10
11
12
# File 'lib/lite/uxid/reversible/base.rb', line 10

def opts
  @opts
end

Class Method Details

.decode(id, opts = {}) ⇒ Object



22
23
24
25
# File 'lib/lite/uxid/reversible/base.rb', line 22

def self.decode(id, opts = {})
  klass = new(id, opts)
  klass.decode
end

.encode(id, opts = {}) ⇒ Object



17
18
19
20
# File 'lib/lite/uxid/reversible/base.rb', line 17

def self.encode(id, opts = {})
  klass = new(id, opts)
  klass.encode
end