Class: ActiveValidation::Values::Version

Inherits:
Base
  • Object
show all
Defined in:
lib/active_validation/values/version.rb

Constant Summary

Constants inherited from Base

Base::BAD_VALUES

Instance Attribute Summary

Attributes inherited from Base

#value

Instance Method Summary collapse

Methods inherited from Base

#<=>, #==, #as_json, #to_s, #to_sym

Constructor Details

#initialize(value) ⇒ Version

Returns a new instance of Version.

Parameters:



7
8
9
10
# File 'lib/active_validation/values/version.rb', line 7

def initialize(value)
  super
  @value = value.respond_to?(:to_int) ? value.to_i : Integer(value.to_s.sub(/\AV/, ""))
end

Instance Method Details

#to_iObject



12
13
14
# File 'lib/active_validation/values/version.rb', line 12

def to_i
  value
end