Method: Maintain::Maintainer#value

Defined in:
lib/maintain/maintainer.rb

#value(instance, initial = nil) ⇒ Object



209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/maintain/maintainer.rb', line 209

def value(instance, initial = nil)
  if back_end
    initial = back_end.read(instance, @attribute)
  end
  initial ||= initial || @default
  if bitmask?
    BitmaskValue.new(self, initial || 0)
  elsif integer?
    IntegerValue.new(self, initial)
  else
    Value.new(self, initial)
  end
end