Class: ActiveValidation::Values::Version
- Defined in:
- lib/active_validation/values/version.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(value) ⇒ Version
constructor
A new instance of Version.
- #to_i ⇒ Object
Methods inherited from Base
#<=>, #==, #as_json, #to_s, #to_sym
Constructor Details
#initialize(value) ⇒ Version
Returns a new instance of Version.
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_i ⇒ Object
12 13 14 |
# File 'lib/active_validation/values/version.rb', line 12 def to_i value end |