Class: Renum::IndexSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/renum/index_serializer.rb

Instance Method Summary collapse

Constructor Details

#initialize(enum_class) ⇒ IndexSerializer

Returns a new instance of IndexSerializer.



3
4
5
# File 'lib/renum/index_serializer.rb', line 3

def initialize enum_class
  @enum_class = enum_class
end

Instance Method Details

#dump(v) ⇒ Object



7
8
9
# File 'lib/renum/index_serializer.rb', line 7

def dump v
  v && v.index
end

#load(i) ⇒ Object



11
12
13
# File 'lib/renum/index_serializer.rb', line 11

def load i
  i && @enum_class[i]
end