https://github.com/ndrive/version-serializer
Serializes and compares semantic versions.
https://github.com/ndrive/version-serializer
Last synced: 11 months ago
JSON representation
Serializes and compares semantic versions.
- Host: GitHub
- URL: https://github.com/ndrive/version-serializer
- Owner: NDrive
- License: mit
- Created: 2014-05-21T15:42:22.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-01-11T16:39:04.000Z (over 8 years ago)
- Last Synced: 2025-06-20T11:44:36.816Z (12 months ago)
- Language: Ruby
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# VersionSerializer
Serializes semantic versions and adds compatibility methods to check if a given
instance is compatible with a certain version by specifying a range.
## Installation
Add this line to your application's Gemfile:
gem 'version_serializer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install version_serializer
## Usage
```ruby
# Model Definition
class YourModel < ActiveRecord::Base
include VersionSerializer::RangeCompatibility
serialize :min_version, VersionSerializer::SemanticVersion
serialize :max_version, VersionSerializer::SemanticVersion
end
# Compatibility
m = YourModel.create(min_version: "1.0.1", max_version: "2.3.4")
m.compatible? "2.0"
```