From d968db718f35812d83ead7ec0c88d9477dea02e6 Mon Sep 17 00:00:00 2001 From: mraffonso <40673565+mraffonso@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:05:57 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20mraffons?= =?UTF-8?q?o/short=5Fversion@e8953379e0259aa5d310a8124060b7563e3750d1=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SemanticVersion.html | 8 ++++---- ShortVersion.html | 26 +++++++++++++------------- ShortVersionConverter.html | 6 +++--- index.html | 2 +- index.json | 2 +- search-index.js | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/SemanticVersion.html b/SemanticVersion.html index 236db56..4887c6b 100644 --- a/SemanticVersion.html +++ b/SemanticVersion.html @@ -142,7 +142,7 @@

- + short_version/extensions/semantic_version.cr @@ -306,7 +306,7 @@


- [View source] + [View source]
@@ -350,7 +350,7 @@


- [View source] + [View source]
@@ -375,7 +375,7 @@


- [View source] + [View source]
diff --git a/ShortVersion.html b/ShortVersion.html index d0e4be9..39fe2ef 100644 --- a/ShortVersion.html +++ b/ShortVersion.html @@ -142,7 +142,7 @@

- + short_version.cr @@ -365,7 +365,7 @@


- [View source] + [View source]
@@ -391,7 +391,7 @@


- [View source] + [View source]
@@ -417,7 +417,7 @@


- [View source] + [View source]
@@ -461,7 +461,7 @@


- [View source] + [View source]
@@ -489,7 +489,7 @@


- [View source] + [View source]
@@ -514,7 +514,7 @@


- [View source] + [View source]
@@ -539,7 +539,7 @@


- [View source] + [View source]
@@ -565,7 +565,7 @@


- [View source] + [View source]
@@ -586,7 +586,7 @@


- [View source] + [View source]
@@ -607,7 +607,7 @@


- [View source] + [View source]
@@ -632,7 +632,7 @@


- [View source] + [View source]
@@ -658,7 +658,7 @@


- [View source] + [View source]
diff --git a/ShortVersionConverter.html b/ShortVersionConverter.html index dafd36b..bb2af9f 100644 --- a/ShortVersionConverter.html +++ b/ShortVersionConverter.html @@ -123,7 +123,7 @@

- + short_version/converter.cr @@ -202,7 +202,7 @@


- [View source] + [View source]
@@ -223,7 +223,7 @@


- [View source] + [View source]
diff --git a/index.html b/index.html index 84b6e0c..5ad0fd6 100644 --- a/index.html +++ b/index.html @@ -129,7 +129,7 @@

ShortVersion.new(major: 2, minor: 3) # => ShortVersion(@major=2, @minor=3) -

OR parse from another format: String or SemanticVersion.

+

Or parse from another format: String or SemanticVersion.

ShortVersion.parse("1.1")
 # => ShortVersion(@major=1, @minor=1)
 
diff --git a/index.json b/index.json
index 97603d9..d9545ec 100644
--- a/index.json
+++ b/index.json
@@ -1 +1 @@
-{"repository_name":"short_version","body":"# short_version\n\nA versioning scheme that uses only major and minor version numbers.\n\n[![CI](https://github.com/mraffonso/short_version/actions/workflows/ci.yml/badge.svg)](https://github.com/mraffonso/short_version/actions/workflows/ci.yml)\n[![Static Badge](https://img.shields.io/badge/Docs-GH_Pages-blue.svg)](https://mraffonso.github.io/short_version/)\n[![Release](https://img.shields.io/badge/Release-v0.1.0-blue.svg)](https://github.com/mraffonso/short_version/releases)\n[![Release](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/mraffonso/short_version/blob/main/LICENSE)\n\n## Features\n\nBased on [SemanticVersion] from the standard library and is comparable with and convertible to `SemanticVersion`.  Includes a [SemanticVersion Extension] that adds convenience functionality to `SemanticVersion`. and a [ShortVersionConverter] for use with [JSON::Serializable].\n\n## Documentation\n\n* [Library API]\n\n## Installation\n\n1. Add the dependency to your `shard.yml`\n\n```yaml\ndependencies:\n  short_version:\n    github: mraffonso/short_version\n```\n\n2. Run `shards install`\n\n## Usage\n\nRequire the library.\n\n```crystal\nrequire \"short_version\"\n```\n\nCreate a `ShortVersion`.\n\n```crystal\nShortVersion.new(1, 1)\n# => ShortVersion(@major=1, @minor=1)\n\nShortVersion.new(major: 2, minor: 3)\n# => ShortVersion(@major=2, @minor=3)\n```\n\nOR `parse` from another format: `String` or `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.1\")\n# => ShortVersion(@major=1, @minor=1)\n\nsemver = SemanticVersion.new(1, 1, 2)\nShortVersion.parse(semver)\n# => ShortVersion(@major=1, @minor=1)\n```\n\nConvert `ShortVersion` to `SemanticVersion`. **Note**: By default patch version is `0` unless otherwise specified.\n\n```crystal\nshortver = ShortVersion.parse(\"1.1\")\n\nshortver.to_semver # Default patch version is 0\n# => SemanticVersion(@major=1, @minor=1, @patch=0, ...)\n\nshortver.to_semver(1) # Specify patch version\n# => SemanticVersion(@major=1, @minor=1, @patch=1, ...)\n```\n\nCompare `ShortVersion` <=> `ShortVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < ShortVersion.parse(\"1.3\") # => true\nShortVersion.parse(\"1.2\") == ShortVersion.parse(\"1.2\") # => true\nShortVersion.parse(\"1.2\") > ShortVersion.parse(\"1.1\") # => true\n```\n\nCompare `ShortVersion` <=> `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < SemanticVersion.parse(\"1.3.0\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") > SemanticVersion.parse(\"1.1.19\") # => true\n```\n\n### ShortVersionConverter (Optional)\n\nConverter to be used with [JSON::Serializable]  to serialize a `ShortVersion`.\n\nRequire the converter.\n\n```crystal\nrequire \"short_version/converter\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\nAdd the converter to the JSON::Field decorator.\n\n```crystal\nstruct Example\n  include JSON::Serializable\n\n  def initialize(@short_version)\n  end\n\n  @[JSON::Field(converter: ShortVersionConverter)]\n  property short_version : ShortVersion\nend\n```\n\nParse json string and convert to `ShortVersion`.\n\n```crystal\nexample = Example.from_json(\"{\\\"short_version\\\":\\\"1.2\\\"}\")\nexample.short_version # => ShortVersion(@major=1, @minor=2)\n```\n\nConvert `ShortVersion` to json string.\n\n```crystal\nshortver = ShortVersion.parse(\"1.0\")\nexample = Example.new(short_version: shortver)\nexample.to_json # => \"{\\\"short_version\\\":\\\"1.0\\\"}\"\n```\n\n### SemanticVersion Extension (Optional)\n\nExtending SemanticVersion is unnecessary but it adds some nice conveniences and may allow your code to flow more naturally.\n\n**Note**: It extends the `SemanticVersion` Struct from the standard library by adding a `to_shortver` instance method and `Comparable(ShortVersion)` functionality.\n\nRequire the extension.\n\n```crystal\nrequire \"short_version/extensions/semantic_version\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\n```crystal\nsemver = SemanticVersion.parse(\"1.2.3\")\nsemver.to_shortver # => ShortVersion(@major=1, @minor=2)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\n`SemanticVersion` parse `ShortVersion`.\n\n```crystal\nshortver = ShortVersion.new(1, 2)\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=2, @patch=0, ...)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\nCompare `SemanticVersion` <=> `ShortVersion`.\n\n```crystal\nSemanticVersion.parse(\"1.2.3\") < ShortVersion.parse(\"1.3\") # => true\nSemanticVersion.parse(\"1.2.3\") == ShortVersion.parse(\"1.2\") # => true\nSemanticVersion.parse(\"1.2.3\") > ShortVersion.parse(\"1.1\") # => true\n\n# Without the extension comparison must be reversed\nShortVersion.parse(\"1.1\") < SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.3\") > SemanticVersion.parse(\"1.2.3\") # => true\n```\n\n## Releasing\n\nCreating a realease is just tagging a git commit.  The `./script/tag` shell script should be used for creating tags.\n\nThe current release workflow is:\n\n* update the version specified in `shard.yml`\n* commit with the message \"Bump version to x.x.x\"\n* push to main\n* run the tag script with no arguments `./script/tag`\n* confirm tag creation\n\nAnd that's it, a release is created.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Mario Affonso](https://github.com/mraffonso) - creator and maintainer\n\n[JSON::Serializable]: https://crystal-lang.org/api/JSON/Serializable.html\n[Library API]: https://mraffonso.github.io/short_version/\n[SemanticVersion]: https://crystal-lang.org/api/SemanticVersion.html\n[SemanticVersion Extension]: https://mraffonso.github.io/short_version/SemanticVersion.html\n[ShortVersionConverter]: https://mraffonso.github.io/short_version/ShortVersionConverter.html\n\n","program":{"html_id":"short_version/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"short_version","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"short_version/SemanticVersion","path":"SemanticVersion.html","kind":"struct","full_name":"SemanticVersion","name":"SemanticVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version/extensions/semantic_version.cr","line_number":1,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L1"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Semantic Versioning 2.0.0\n\nSee [https://semver.org/](https://semver.org/) for more information.","summary":"

Conforms to Semantic Versioning 2.0.0

","constructors":[{"html_id":"parse(str:ShortVersion):self-class-method","name":"parse","doc":"Parses a `SemanticVersion` from the given `ShortVersion`\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nshortver = ShortVersion.parse(\"1.23\")\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=23, @patch=0, ... )\n```","summary":"

Parses a SemanticVersion from the given ShortVersion

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"args_string":"(str : ShortVersion) : self","args_html":"(str : ShortVersion) : self","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":13,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L13"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"return_type":"self","visibility":"Public","body":"major = str.major\nminor = str.minor\nnew(major, minor, 0)\n"}}],"instance_methods":[{"html_id":"<=>(other:ShortVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with ShortVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.3\") # => -1\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.2\") # => 0\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.1\") # => 1\n```","summary":"

The comparison operator with ShortVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"args_string":"(other : ShortVersion) : Int32","args_html":"(other : ShortVersion) : Int32","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":43,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L43"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"to_shortver-instance-method","name":"to_shortver","doc":"Returns the `ShortVersion` representation of this semantic version\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nsemver = SemanticVersion.parse(\"0.39.3\")\nsemver.to_shortver # => ShortVersion(@major=0, @minor=39)\n```","summary":"

Returns the ShortVersion representation of this semantic version

","abstract":false,"location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":27,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L27"},"def":{"name":"to_shortver","visibility":"Public","body":"ShortVersion.new(major, minor)"}}]},{"html_id":"short_version/ShortVersion","path":"ShortVersion.html","kind":"struct","full_name":"ShortVersion","name":"ShortVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version.cr","line_number":6,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L6"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Short Versioning\n\nSimilar to [Semantic Versioning](https://semver.org/) but only with major and minor version numbers.","summary":"

Conforms to Short Versioning

","constructors":[{"html_id":"new(major:Int,minor:Int)-class-method","name":"new","doc":"Creates a new `ShortVersion` instance with the given major and minor\nversion.","summary":"

Creates a new ShortVersion instance with the given major and minor version.

","abstract":false,"args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"args_string":"(major : Int, minor : Int)","args_html":"(major : Int, minor : Int)","location":{"filename":"src/short_version.cr","line_number":51,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L51"},"def":{"name":"new","args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(major, minor)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"parse(version:String):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given short version string.\n\n```\nrequire \"short_version\"\"\n\nshortver = ShortVersion.parse(\"2.61\")\nshortver # => ShortVersion(@major=2, @minor=61)\n```\n\nRaises `ArgumentError` if *str* is not a short version.","summary":"

Parses a ShortVersion from the given short version string.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"String"}],"args_string":"(version : String) : self","args_html":"(version : String) : self","location":{"filename":"src/short_version.cr","line_number":26,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L26"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"String"}],"return_type":"self","visibility":"Public","body":"if m = version.match(/^(?\\d+)\\.(?\\d+)$/)\n major = m[\"major\"].to_i\n minor = m[\"minor\"].to_i\n new(major, minor)\nelse\n raise(ArgumentError.new(\"Not a short version: #{version.inspect}\"))\nend"}},{"html_id":"parse(version:SemanticVersion):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given `SemanticVersion`.\n\n```\nrequire \"short_version\"\"\n\nsemver = SemanticVersion.parse(\"2.61.9\")\nshortver = ShortVersion.parse(semver)\nshortver # => ShortVersion(@major=2, @minor=61)\n```","summary":"

Parses a ShortVersion from the given SemanticVersion.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"args_string":"(version : SemanticVersion) : self","args_html":"(version : SemanticVersion) : self","location":{"filename":"src/short_version.cr","line_number":45,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L45"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"return_type":"self","visibility":"Public","body":"new(version.major, version.minor)"}}],"instance_methods":[{"html_id":"<=>(other:self):Int32-instance-method","name":"<=>","doc":"The comparison operator with self.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"2.0\") # => -1\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"1.0\") # => 0\nShortVersion.parse(\"2.0\") <=> ShortVersion.parse(\"1.0\") # => 1\n```","summary":"

The comparison operator with self.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self) : Int32","args_html":"(other : self) : Int32","location":{"filename":"src/short_version.cr","line_number":128,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L128"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"self"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"<=>(other:SemanticVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with SemanticVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"2.0.0\") # => -1\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"1.0.0\") # => 0\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"0.1.0\") # => 1\n```","summary":"

The comparison operator with SemanticVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"args_string":"(other : SemanticVersion) : Int32","args_html":"(other : SemanticVersion) : Int32","location":{"filename":"src/short_version.cr","line_number":149,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L149"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"bump_major-instance-method","name":"bump_major","doc":"Returns a copy of the current version with a major bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_major # => ShortVersion(@major=2, @minor=0)\n```","summary":"

Returns a copy of the current version with a major bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":100,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L100"},"def":{"name":"bump_major","visibility":"Public","body":"copy_with(major: major + 1, minor: 0)"}},{"html_id":"bump_minor-instance-method","name":"bump_minor","doc":"Returns a copy of the current version with a minor bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_minor # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a copy of the current version with a minor bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":112,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L112"},"def":{"name":"bump_minor","visibility":"Public","body":"copy_with(minor: minor + 1)"}},{"html_id":"copy_with(major:Int32=@major,minor:Int32=@minor)-instance-method","name":"copy_with","doc":"Returns a new `ShortVersion` created with the specified parts. The\ndefault for each part is its current value.\n\n```\nrequire \"short_version\"\n\ncurrent_version = ShortVersion.parse(\"1.1\")\ncurrent_version.copy_with(minor: 2) # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a new ShortVersion created with the specified parts.

","abstract":false,"args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"args_string":"(major : Int32 = @major, minor : Int32 = @minor)","args_html":"(major : Int32 = @major, minor : Int32 = @minor)","location":{"filename":"src/short_version.cr","line_number":88,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L88"},"def":{"name":"copy_with","args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"visibility":"Public","body":"ShortVersion.new(major, minor)"}},{"html_id":"major:Int32-instance-method","name":"major","doc":"The major version of this short version","summary":"

The major version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L11"},"def":{"name":"major","return_type":"Int32","visibility":"Public","body":"@major"}},{"html_id":"minor:Int32-instance-method","name":"minor","doc":"The minor version of this short version","summary":"

The minor version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":14,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L14"},"def":{"name":"minor","return_type":"Int32","visibility":"Public","body":"@minor"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Returns the string representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_s # => \"0.27\"\n```","summary":"

Returns the string representation of this short version

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/short_version.cr","line_number":62,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L62"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"((io << major) << '.') << minor"}},{"html_id":"to_semver(patch:Int=0):SemanticVersion-instance-method","name":"to_semver","doc":"Returns the `SemanticVersion` representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_semver # => SemanticVersion(@major=0, @minor=27, @patch=0, ...)\nshortver.to_semver(1) # => SemanticVersion(@major=0, @minor=27, @patch=1, ...)\n```","summary":"

Returns the SemanticVersion representation of this short version

","abstract":false,"args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"args_string":"(patch : Int = 0) : SemanticVersion","args_html":"(patch : Int = 0) : SemanticVersion","location":{"filename":"src/short_version.cr","line_number":75,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L75"},"def":{"name":"to_semver","args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"return_type":"SemanticVersion","visibility":"Public","body":"SemanticVersion.new(major: major, minor: minor, patch: patch)"}}]},{"html_id":"short_version/ShortVersionConverter","path":"ShortVersionConverter.html","kind":"module","full_name":"ShortVersionConverter","name":"ShortVersionConverter","abstract":false,"locations":[{"filename":"src/short_version/converter.cr","line_number":5,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L5"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"doc":"Converter to be used with `JSON::Serializable` to serialize a `ShortVersion`.","summary":"

Converter to be used with JSON::Serializable to serialize a ShortVersion.

","class_methods":[{"html_id":"from_json(value:JSON::PullParser):ShortVersion-class-method","name":"from_json","doc":"Reads a serialized ShortVersion by value from *pull*.\n\nSee `.to_json` for reference.\n\nRaises `JSON::ParseException` if the deserialization fails.","summary":"

Reads a serialized ShortVersion by value from pull.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"args_string":"(value : JSON::PullParser) : ShortVersion","args_html":"(value : JSON::PullParser) : ShortVersion","location":{"filename":"src/short_version/converter.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L11"},"def":{"name":"from_json","args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"return_type":"ShortVersion","visibility":"Public","body":"ShortVersion.parse(value.read_string)"}},{"html_id":"to_json(value:ShortVersion,json:JSON::Builder):Nil-class-method","name":"to_json","doc":"Serializes a `ShortVersion` value as a String from *value*.","summary":"

Serializes a ShortVersion value as a String from value.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(value : ShortVersion, json : JSON::Builder) : Nil","args_html":"(value : ShortVersion, json : JSON::Builder) : Nil","location":{"filename":"src/short_version/converter.cr","line_number":16,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L16"},"def":{"name":"to_json","args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(value.to_s)"}}]}]}} \ No newline at end of file +{"repository_name":"short_version","body":"# short_version\n\nA versioning scheme that uses only major and minor version numbers.\n\n[![CI](https://github.com/mraffonso/short_version/actions/workflows/ci.yml/badge.svg)](https://github.com/mraffonso/short_version/actions/workflows/ci.yml)\n[![Static Badge](https://img.shields.io/badge/Docs-GH_Pages-blue.svg)](https://mraffonso.github.io/short_version/)\n[![Release](https://img.shields.io/badge/Release-v0.1.0-blue.svg)](https://github.com/mraffonso/short_version/releases)\n[![Release](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/mraffonso/short_version/blob/main/LICENSE)\n\n## Features\n\nBased on [SemanticVersion] from the standard library and is comparable with and convertible to `SemanticVersion`. Includes a [SemanticVersion Extension] that adds convenience functionality to `SemanticVersion`. and a [ShortVersionConverter] for use with [JSON::Serializable].\n\n## Documentation\n\n* [Library API]\n\n## Installation\n\n1. Add the dependency to your `shard.yml`\n\n```yaml\ndependencies:\n short_version:\n github: mraffonso/short_version\n```\n\n2. Run `shards install`\n\n## Usage\n\nRequire the library.\n\n```crystal\nrequire \"short_version\"\n```\n\nCreate a `ShortVersion`.\n\n```crystal\nShortVersion.new(1, 1)\n# => ShortVersion(@major=1, @minor=1)\n\nShortVersion.new(major: 2, minor: 3)\n# => ShortVersion(@major=2, @minor=3)\n```\n\nOr `parse` from another format: `String` or `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.1\")\n# => ShortVersion(@major=1, @minor=1)\n\nsemver = SemanticVersion.new(1, 1, 2)\nShortVersion.parse(semver)\n# => ShortVersion(@major=1, @minor=1)\n```\n\nConvert `ShortVersion` to `SemanticVersion`. **Note**: By default patch version is `0` unless otherwise specified.\n\n```crystal\nshortver = ShortVersion.parse(\"1.1\")\n\nshortver.to_semver # Default patch version is 0\n# => SemanticVersion(@major=1, @minor=1, @patch=0, ...)\n\nshortver.to_semver(1) # Specify patch version\n# => SemanticVersion(@major=1, @minor=1, @patch=1, ...)\n```\n\nCompare `ShortVersion` <=> `ShortVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < ShortVersion.parse(\"1.3\") # => true\nShortVersion.parse(\"1.2\") == ShortVersion.parse(\"1.2\") # => true\nShortVersion.parse(\"1.2\") > ShortVersion.parse(\"1.1\") # => true\n```\n\nCompare `ShortVersion` <=> `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < SemanticVersion.parse(\"1.3.0\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") > SemanticVersion.parse(\"1.1.19\") # => true\n```\n\n### ShortVersionConverter (Optional)\n\nConverter to be used with [JSON::Serializable] to serialize a `ShortVersion`.\n\nRequire the converter.\n\n```crystal\nrequire \"short_version/converter\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\nAdd the converter to the JSON::Field decorator.\n\n```crystal\nstruct Example\n include JSON::Serializable\n\n def initialize(@short_version)\n end\n\n @[JSON::Field(converter: ShortVersionConverter)]\n property short_version : ShortVersion\nend\n```\n\nParse json string and convert to `ShortVersion`.\n\n```crystal\nexample = Example.from_json(\"{\\\"short_version\\\":\\\"1.2\\\"}\")\nexample.short_version # => ShortVersion(@major=1, @minor=2)\n```\n\nConvert `ShortVersion` to json string.\n\n```crystal\nshortver = ShortVersion.parse(\"1.0\")\nexample = Example.new(short_version: shortver)\nexample.to_json # => \"{\\\"short_version\\\":\\\"1.0\\\"}\"\n```\n\n### SemanticVersion Extension (Optional)\n\nExtending SemanticVersion is unnecessary but it adds some nice conveniences and may allow your code to flow more naturally.\n\n**Note**: It extends the `SemanticVersion` Struct from the standard library by adding a `to_shortver` instance method and `Comparable(ShortVersion)` functionality.\n\nRequire the extension.\n\n```crystal\nrequire \"short_version/extensions/semantic_version\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\n```crystal\nsemver = SemanticVersion.parse(\"1.2.3\")\nsemver.to_shortver # => ShortVersion(@major=1, @minor=2)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\n`SemanticVersion` parse `ShortVersion`.\n\n```crystal\nshortver = ShortVersion.new(1, 2)\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=2, @patch=0, ...)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\nCompare `SemanticVersion` <=> `ShortVersion`.\n\n```crystal\nSemanticVersion.parse(\"1.2.3\") < ShortVersion.parse(\"1.3\") # => true\nSemanticVersion.parse(\"1.2.3\") == ShortVersion.parse(\"1.2\") # => true\nSemanticVersion.parse(\"1.2.3\") > ShortVersion.parse(\"1.1\") # => true\n\n# Without the extension comparison must be reversed\nShortVersion.parse(\"1.1\") < SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.3\") > SemanticVersion.parse(\"1.2.3\") # => true\n```\n\n## Releasing\n\nCreating a realease is just tagging a git commit. The `./script/tag` shell script should be used for creating tags.\n\nThe current release workflow is:\n\n* update the version specified in `shard.yml`\n* commit with the message \"Bump version to x.x.x\"\n* push to main\n* run the tag script with no arguments `./script/tag`\n* confirm tag creation\n\nAnd that's it, a release is created.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Mario Affonso](https://github.com/mraffonso) - creator and maintainer\n\n[JSON::Serializable]: https://crystal-lang.org/api/JSON/Serializable.html\n[Library API]: https://mraffonso.github.io/short_version/\n[SemanticVersion]: https://crystal-lang.org/api/SemanticVersion.html\n[SemanticVersion Extension]: https://mraffonso.github.io/short_version/SemanticVersion.html\n[ShortVersionConverter]: https://mraffonso.github.io/short_version/ShortVersionConverter.html\n\n","program":{"html_id":"short_version/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"short_version","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"short_version/SemanticVersion","path":"SemanticVersion.html","kind":"struct","full_name":"SemanticVersion","name":"SemanticVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version/extensions/semantic_version.cr","line_number":1,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L1"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Semantic Versioning 2.0.0\n\nSee [https://semver.org/](https://semver.org/) for more information.","summary":"

Conforms to Semantic Versioning 2.0.0

","constructors":[{"html_id":"parse(str:ShortVersion):self-class-method","name":"parse","doc":"Parses a `SemanticVersion` from the given `ShortVersion`\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nshortver = ShortVersion.parse(\"1.23\")\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=23, @patch=0, ... )\n```","summary":"

Parses a SemanticVersion from the given ShortVersion

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"args_string":"(str : ShortVersion) : self","args_html":"(str : ShortVersion) : self","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":13,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L13"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"return_type":"self","visibility":"Public","body":"major = str.major\nminor = str.minor\nnew(major, minor, 0)\n"}}],"instance_methods":[{"html_id":"<=>(other:ShortVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with ShortVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.3\") # => -1\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.2\") # => 0\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.1\") # => 1\n```","summary":"

The comparison operator with ShortVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"args_string":"(other : ShortVersion) : Int32","args_html":"(other : ShortVersion) : Int32","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":43,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L43"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"to_shortver-instance-method","name":"to_shortver","doc":"Returns the `ShortVersion` representation of this semantic version\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nsemver = SemanticVersion.parse(\"0.39.3\")\nsemver.to_shortver # => ShortVersion(@major=0, @minor=39)\n```","summary":"

Returns the ShortVersion representation of this semantic version

","abstract":false,"location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":27,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L27"},"def":{"name":"to_shortver","visibility":"Public","body":"ShortVersion.new(major, minor)"}}]},{"html_id":"short_version/ShortVersion","path":"ShortVersion.html","kind":"struct","full_name":"ShortVersion","name":"ShortVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version.cr","line_number":6,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L6"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Short Versioning\n\nSimilar to [Semantic Versioning](https://semver.org/) but only with major and minor version numbers.","summary":"

Conforms to Short Versioning

","constructors":[{"html_id":"new(major:Int,minor:Int)-class-method","name":"new","doc":"Creates a new `ShortVersion` instance with the given major and minor\nversion.","summary":"

Creates a new ShortVersion instance with the given major and minor version.

","abstract":false,"args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"args_string":"(major : Int, minor : Int)","args_html":"(major : Int, minor : Int)","location":{"filename":"src/short_version.cr","line_number":51,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L51"},"def":{"name":"new","args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(major, minor)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"parse(version:String):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given short version string.\n\n```\nrequire \"short_version\"\"\n\nshortver = ShortVersion.parse(\"2.61\")\nshortver # => ShortVersion(@major=2, @minor=61)\n```\n\nRaises `ArgumentError` if *str* is not a short version.","summary":"

Parses a ShortVersion from the given short version string.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"String"}],"args_string":"(version : String) : self","args_html":"(version : String) : self","location":{"filename":"src/short_version.cr","line_number":26,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L26"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"String"}],"return_type":"self","visibility":"Public","body":"if m = version.match(/^(?\\d+)\\.(?\\d+)$/)\n major = m[\"major\"].to_i\n minor = m[\"minor\"].to_i\n new(major, minor)\nelse\n raise(ArgumentError.new(\"Not a short version: #{version.inspect}\"))\nend"}},{"html_id":"parse(version:SemanticVersion):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given `SemanticVersion`.\n\n```\nrequire \"short_version\"\"\n\nsemver = SemanticVersion.parse(\"2.61.9\")\nshortver = ShortVersion.parse(semver)\nshortver # => ShortVersion(@major=2, @minor=61)\n```","summary":"

Parses a ShortVersion from the given SemanticVersion.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"args_string":"(version : SemanticVersion) : self","args_html":"(version : SemanticVersion) : self","location":{"filename":"src/short_version.cr","line_number":45,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L45"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"return_type":"self","visibility":"Public","body":"new(version.major, version.minor)"}}],"instance_methods":[{"html_id":"<=>(other:self):Int32-instance-method","name":"<=>","doc":"The comparison operator with self.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"2.0\") # => -1\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"1.0\") # => 0\nShortVersion.parse(\"2.0\") <=> ShortVersion.parse(\"1.0\") # => 1\n```","summary":"

The comparison operator with self.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self) : Int32","args_html":"(other : self) : Int32","location":{"filename":"src/short_version.cr","line_number":128,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L128"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"self"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"<=>(other:SemanticVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with SemanticVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"2.0.0\") # => -1\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"1.0.0\") # => 0\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"0.1.0\") # => 1\n```","summary":"

The comparison operator with SemanticVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"args_string":"(other : SemanticVersion) : Int32","args_html":"(other : SemanticVersion) : Int32","location":{"filename":"src/short_version.cr","line_number":149,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L149"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"bump_major-instance-method","name":"bump_major","doc":"Returns a copy of the current version with a major bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_major # => ShortVersion(@major=2, @minor=0)\n```","summary":"

Returns a copy of the current version with a major bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":100,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L100"},"def":{"name":"bump_major","visibility":"Public","body":"copy_with(major: major + 1, minor: 0)"}},{"html_id":"bump_minor-instance-method","name":"bump_minor","doc":"Returns a copy of the current version with a minor bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_minor # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a copy of the current version with a minor bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":112,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L112"},"def":{"name":"bump_minor","visibility":"Public","body":"copy_with(minor: minor + 1)"}},{"html_id":"copy_with(major:Int32=@major,minor:Int32=@minor)-instance-method","name":"copy_with","doc":"Returns a new `ShortVersion` created with the specified parts. The\ndefault for each part is its current value.\n\n```\nrequire \"short_version\"\n\ncurrent_version = ShortVersion.parse(\"1.1\")\ncurrent_version.copy_with(minor: 2) # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a new ShortVersion created with the specified parts.

","abstract":false,"args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"args_string":"(major : Int32 = @major, minor : Int32 = @minor)","args_html":"(major : Int32 = @major, minor : Int32 = @minor)","location":{"filename":"src/short_version.cr","line_number":88,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L88"},"def":{"name":"copy_with","args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"visibility":"Public","body":"ShortVersion.new(major, minor)"}},{"html_id":"major:Int32-instance-method","name":"major","doc":"The major version of this short version","summary":"

The major version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L11"},"def":{"name":"major","return_type":"Int32","visibility":"Public","body":"@major"}},{"html_id":"minor:Int32-instance-method","name":"minor","doc":"The minor version of this short version","summary":"

The minor version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":14,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L14"},"def":{"name":"minor","return_type":"Int32","visibility":"Public","body":"@minor"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Returns the string representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_s # => \"0.27\"\n```","summary":"

Returns the string representation of this short version

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/short_version.cr","line_number":62,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L62"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"((io << major) << '.') << minor"}},{"html_id":"to_semver(patch:Int=0):SemanticVersion-instance-method","name":"to_semver","doc":"Returns the `SemanticVersion` representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_semver # => SemanticVersion(@major=0, @minor=27, @patch=0, ...)\nshortver.to_semver(1) # => SemanticVersion(@major=0, @minor=27, @patch=1, ...)\n```","summary":"

Returns the SemanticVersion representation of this short version

","abstract":false,"args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"args_string":"(patch : Int = 0) : SemanticVersion","args_html":"(patch : Int = 0) : SemanticVersion","location":{"filename":"src/short_version.cr","line_number":75,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L75"},"def":{"name":"to_semver","args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"return_type":"SemanticVersion","visibility":"Public","body":"SemanticVersion.new(major: major, minor: minor, patch: patch)"}}]},{"html_id":"short_version/ShortVersionConverter","path":"ShortVersionConverter.html","kind":"module","full_name":"ShortVersionConverter","name":"ShortVersionConverter","abstract":false,"locations":[{"filename":"src/short_version/converter.cr","line_number":5,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L5"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"doc":"Converter to be used with `JSON::Serializable` to serialize a `ShortVersion`.","summary":"

Converter to be used with JSON::Serializable to serialize a ShortVersion.

","class_methods":[{"html_id":"from_json(value:JSON::PullParser):ShortVersion-class-method","name":"from_json","doc":"Reads a serialized ShortVersion by value from *pull*.\n\nSee `.to_json` for reference.\n\nRaises `JSON::ParseException` if the deserialization fails.","summary":"

Reads a serialized ShortVersion by value from pull.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"args_string":"(value : JSON::PullParser) : ShortVersion","args_html":"(value : JSON::PullParser) : ShortVersion","location":{"filename":"src/short_version/converter.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L11"},"def":{"name":"from_json","args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"return_type":"ShortVersion","visibility":"Public","body":"ShortVersion.parse(value.read_string)"}},{"html_id":"to_json(value:ShortVersion,json:JSON::Builder):Nil-class-method","name":"to_json","doc":"Serializes a `ShortVersion` value as a String from *value*.","summary":"

Serializes a ShortVersion value as a String from value.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(value : ShortVersion, json : JSON::Builder) : Nil","args_html":"(value : ShortVersion, json : JSON::Builder) : Nil","location":{"filename":"src/short_version/converter.cr","line_number":16,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L16"},"def":{"name":"to_json","args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(value.to_s)"}}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index a93ed90..bd7cdd5 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"short_version","body":"# short_version\n\nA versioning scheme that uses only major and minor version numbers.\n\n[![CI](https://github.com/mraffonso/short_version/actions/workflows/ci.yml/badge.svg)](https://github.com/mraffonso/short_version/actions/workflows/ci.yml)\n[![Static Badge](https://img.shields.io/badge/Docs-GH_Pages-blue.svg)](https://mraffonso.github.io/short_version/)\n[![Release](https://img.shields.io/badge/Release-v0.1.0-blue.svg)](https://github.com/mraffonso/short_version/releases)\n[![Release](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/mraffonso/short_version/blob/main/LICENSE)\n\n## Features\n\nBased on [SemanticVersion] from the standard library and is comparable with and convertible to `SemanticVersion`. Includes a [SemanticVersion Extension] that adds convenience functionality to `SemanticVersion`. and a [ShortVersionConverter] for use with [JSON::Serializable].\n\n## Documentation\n\n* [Library API]\n\n## Installation\n\n1. Add the dependency to your `shard.yml`\n\n```yaml\ndependencies:\n short_version:\n github: mraffonso/short_version\n```\n\n2. Run `shards install`\n\n## Usage\n\nRequire the library.\n\n```crystal\nrequire \"short_version\"\n```\n\nCreate a `ShortVersion`.\n\n```crystal\nShortVersion.new(1, 1)\n# => ShortVersion(@major=1, @minor=1)\n\nShortVersion.new(major: 2, minor: 3)\n# => ShortVersion(@major=2, @minor=3)\n```\n\nOR `parse` from another format: `String` or `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.1\")\n# => ShortVersion(@major=1, @minor=1)\n\nsemver = SemanticVersion.new(1, 1, 2)\nShortVersion.parse(semver)\n# => ShortVersion(@major=1, @minor=1)\n```\n\nConvert `ShortVersion` to `SemanticVersion`. **Note**: By default patch version is `0` unless otherwise specified.\n\n```crystal\nshortver = ShortVersion.parse(\"1.1\")\n\nshortver.to_semver # Default patch version is 0\n# => SemanticVersion(@major=1, @minor=1, @patch=0, ...)\n\nshortver.to_semver(1) # Specify patch version\n# => SemanticVersion(@major=1, @minor=1, @patch=1, ...)\n```\n\nCompare `ShortVersion` <=> `ShortVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < ShortVersion.parse(\"1.3\") # => true\nShortVersion.parse(\"1.2\") == ShortVersion.parse(\"1.2\") # => true\nShortVersion.parse(\"1.2\") > ShortVersion.parse(\"1.1\") # => true\n```\n\nCompare `ShortVersion` <=> `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < SemanticVersion.parse(\"1.3.0\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") > SemanticVersion.parse(\"1.1.19\") # => true\n```\n\n### ShortVersionConverter (Optional)\n\nConverter to be used with [JSON::Serializable] to serialize a `ShortVersion`.\n\nRequire the converter.\n\n```crystal\nrequire \"short_version/converter\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\nAdd the converter to the JSON::Field decorator.\n\n```crystal\nstruct Example\n include JSON::Serializable\n\n def initialize(@short_version)\n end\n\n @[JSON::Field(converter: ShortVersionConverter)]\n property short_version : ShortVersion\nend\n```\n\nParse json string and convert to `ShortVersion`.\n\n```crystal\nexample = Example.from_json(\"{\\\"short_version\\\":\\\"1.2\\\"}\")\nexample.short_version # => ShortVersion(@major=1, @minor=2)\n```\n\nConvert `ShortVersion` to json string.\n\n```crystal\nshortver = ShortVersion.parse(\"1.0\")\nexample = Example.new(short_version: shortver)\nexample.to_json # => \"{\\\"short_version\\\":\\\"1.0\\\"}\"\n```\n\n### SemanticVersion Extension (Optional)\n\nExtending SemanticVersion is unnecessary but it adds some nice conveniences and may allow your code to flow more naturally.\n\n**Note**: It extends the `SemanticVersion` Struct from the standard library by adding a `to_shortver` instance method and `Comparable(ShortVersion)` functionality.\n\nRequire the extension.\n\n```crystal\nrequire \"short_version/extensions/semantic_version\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\n```crystal\nsemver = SemanticVersion.parse(\"1.2.3\")\nsemver.to_shortver # => ShortVersion(@major=1, @minor=2)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\n`SemanticVersion` parse `ShortVersion`.\n\n```crystal\nshortver = ShortVersion.new(1, 2)\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=2, @patch=0, ...)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\nCompare `SemanticVersion` <=> `ShortVersion`.\n\n```crystal\nSemanticVersion.parse(\"1.2.3\") < ShortVersion.parse(\"1.3\") # => true\nSemanticVersion.parse(\"1.2.3\") == ShortVersion.parse(\"1.2\") # => true\nSemanticVersion.parse(\"1.2.3\") > ShortVersion.parse(\"1.1\") # => true\n\n# Without the extension comparison must be reversed\nShortVersion.parse(\"1.1\") < SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.3\") > SemanticVersion.parse(\"1.2.3\") # => true\n```\n\n## Releasing\n\nCreating a realease is just tagging a git commit. The `./script/tag` shell script should be used for creating tags.\n\nThe current release workflow is:\n\n* update the version specified in `shard.yml`\n* commit with the message \"Bump version to x.x.x\"\n* push to main\n* run the tag script with no arguments `./script/tag`\n* confirm tag creation\n\nAnd that's it, a release is created.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Mario Affonso](https://github.com/mraffonso) - creator and maintainer\n\n[JSON::Serializable]: https://crystal-lang.org/api/JSON/Serializable.html\n[Library API]: https://mraffonso.github.io/short_version/\n[SemanticVersion]: https://crystal-lang.org/api/SemanticVersion.html\n[SemanticVersion Extension]: https://mraffonso.github.io/short_version/SemanticVersion.html\n[ShortVersionConverter]: https://mraffonso.github.io/short_version/ShortVersionConverter.html\n\n","program":{"html_id":"short_version/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"short_version","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"short_version/SemanticVersion","path":"SemanticVersion.html","kind":"struct","full_name":"SemanticVersion","name":"SemanticVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version/extensions/semantic_version.cr","line_number":1,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L1"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Semantic Versioning 2.0.0\n\nSee [https://semver.org/](https://semver.org/) for more information.","summary":"

Conforms to Semantic Versioning 2.0.0

","constructors":[{"html_id":"parse(str:ShortVersion):self-class-method","name":"parse","doc":"Parses a `SemanticVersion` from the given `ShortVersion`\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nshortver = ShortVersion.parse(\"1.23\")\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=23, @patch=0, ... )\n```","summary":"

Parses a SemanticVersion from the given ShortVersion

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"args_string":"(str : ShortVersion) : self","args_html":"(str : ShortVersion) : self","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":13,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L13"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"return_type":"self","visibility":"Public","body":"major = str.major\nminor = str.minor\nnew(major, minor, 0)\n"}}],"instance_methods":[{"html_id":"<=>(other:ShortVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with ShortVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.3\") # => -1\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.2\") # => 0\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.1\") # => 1\n```","summary":"

The comparison operator with ShortVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"args_string":"(other : ShortVersion) : Int32","args_html":"(other : ShortVersion) : Int32","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":43,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L43"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"to_shortver-instance-method","name":"to_shortver","doc":"Returns the `ShortVersion` representation of this semantic version\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nsemver = SemanticVersion.parse(\"0.39.3\")\nsemver.to_shortver # => ShortVersion(@major=0, @minor=39)\n```","summary":"

Returns the ShortVersion representation of this semantic version

","abstract":false,"location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":27,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/extensions/semantic_version.cr#L27"},"def":{"name":"to_shortver","visibility":"Public","body":"ShortVersion.new(major, minor)"}}]},{"html_id":"short_version/ShortVersion","path":"ShortVersion.html","kind":"struct","full_name":"ShortVersion","name":"ShortVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version.cr","line_number":6,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L6"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Short Versioning\n\nSimilar to [Semantic Versioning](https://semver.org/) but only with major and minor version numbers.","summary":"

Conforms to Short Versioning

","constructors":[{"html_id":"new(major:Int,minor:Int)-class-method","name":"new","doc":"Creates a new `ShortVersion` instance with the given major and minor\nversion.","summary":"

Creates a new ShortVersion instance with the given major and minor version.

","abstract":false,"args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"args_string":"(major : Int, minor : Int)","args_html":"(major : Int, minor : Int)","location":{"filename":"src/short_version.cr","line_number":51,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L51"},"def":{"name":"new","args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(major, minor)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"parse(version:String):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given short version string.\n\n```\nrequire \"short_version\"\"\n\nshortver = ShortVersion.parse(\"2.61\")\nshortver # => ShortVersion(@major=2, @minor=61)\n```\n\nRaises `ArgumentError` if *str* is not a short version.","summary":"

Parses a ShortVersion from the given short version string.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"String"}],"args_string":"(version : String) : self","args_html":"(version : String) : self","location":{"filename":"src/short_version.cr","line_number":26,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L26"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"String"}],"return_type":"self","visibility":"Public","body":"if m = version.match(/^(?\\d+)\\.(?\\d+)$/)\n major = m[\"major\"].to_i\n minor = m[\"minor\"].to_i\n new(major, minor)\nelse\n raise(ArgumentError.new(\"Not a short version: #{version.inspect}\"))\nend"}},{"html_id":"parse(version:SemanticVersion):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given `SemanticVersion`.\n\n```\nrequire \"short_version\"\"\n\nsemver = SemanticVersion.parse(\"2.61.9\")\nshortver = ShortVersion.parse(semver)\nshortver # => ShortVersion(@major=2, @minor=61)\n```","summary":"

Parses a ShortVersion from the given SemanticVersion.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"args_string":"(version : SemanticVersion) : self","args_html":"(version : SemanticVersion) : self","location":{"filename":"src/short_version.cr","line_number":45,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L45"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"return_type":"self","visibility":"Public","body":"new(version.major, version.minor)"}}],"instance_methods":[{"html_id":"<=>(other:self):Int32-instance-method","name":"<=>","doc":"The comparison operator with self.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"2.0\") # => -1\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"1.0\") # => 0\nShortVersion.parse(\"2.0\") <=> ShortVersion.parse(\"1.0\") # => 1\n```","summary":"

The comparison operator with self.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self) : Int32","args_html":"(other : self) : Int32","location":{"filename":"src/short_version.cr","line_number":128,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L128"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"self"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"<=>(other:SemanticVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with SemanticVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"2.0.0\") # => -1\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"1.0.0\") # => 0\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"0.1.0\") # => 1\n```","summary":"

The comparison operator with SemanticVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"args_string":"(other : SemanticVersion) : Int32","args_html":"(other : SemanticVersion) : Int32","location":{"filename":"src/short_version.cr","line_number":149,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L149"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"bump_major-instance-method","name":"bump_major","doc":"Returns a copy of the current version with a major bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_major # => ShortVersion(@major=2, @minor=0)\n```","summary":"

Returns a copy of the current version with a major bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":100,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L100"},"def":{"name":"bump_major","visibility":"Public","body":"copy_with(major: major + 1, minor: 0)"}},{"html_id":"bump_minor-instance-method","name":"bump_minor","doc":"Returns a copy of the current version with a minor bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_minor # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a copy of the current version with a minor bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":112,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L112"},"def":{"name":"bump_minor","visibility":"Public","body":"copy_with(minor: minor + 1)"}},{"html_id":"copy_with(major:Int32=@major,minor:Int32=@minor)-instance-method","name":"copy_with","doc":"Returns a new `ShortVersion` created with the specified parts. The\ndefault for each part is its current value.\n\n```\nrequire \"short_version\"\n\ncurrent_version = ShortVersion.parse(\"1.1\")\ncurrent_version.copy_with(minor: 2) # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a new ShortVersion created with the specified parts.

","abstract":false,"args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"args_string":"(major : Int32 = @major, minor : Int32 = @minor)","args_html":"(major : Int32 = @major, minor : Int32 = @minor)","location":{"filename":"src/short_version.cr","line_number":88,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L88"},"def":{"name":"copy_with","args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"visibility":"Public","body":"ShortVersion.new(major, minor)"}},{"html_id":"major:Int32-instance-method","name":"major","doc":"The major version of this short version","summary":"

The major version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L11"},"def":{"name":"major","return_type":"Int32","visibility":"Public","body":"@major"}},{"html_id":"minor:Int32-instance-method","name":"minor","doc":"The minor version of this short version","summary":"

The minor version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":14,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L14"},"def":{"name":"minor","return_type":"Int32","visibility":"Public","body":"@minor"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Returns the string representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_s # => \"0.27\"\n```","summary":"

Returns the string representation of this short version

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/short_version.cr","line_number":62,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L62"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"((io << major) << '.') << minor"}},{"html_id":"to_semver(patch:Int=0):SemanticVersion-instance-method","name":"to_semver","doc":"Returns the `SemanticVersion` representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_semver # => SemanticVersion(@major=0, @minor=27, @patch=0, ...)\nshortver.to_semver(1) # => SemanticVersion(@major=0, @minor=27, @patch=1, ...)\n```","summary":"

Returns the SemanticVersion representation of this short version

","abstract":false,"args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"args_string":"(patch : Int = 0) : SemanticVersion","args_html":"(patch : Int = 0) : SemanticVersion","location":{"filename":"src/short_version.cr","line_number":75,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version.cr#L75"},"def":{"name":"to_semver","args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"return_type":"SemanticVersion","visibility":"Public","body":"SemanticVersion.new(major: major, minor: minor, patch: patch)"}}]},{"html_id":"short_version/ShortVersionConverter","path":"ShortVersionConverter.html","kind":"module","full_name":"ShortVersionConverter","name":"ShortVersionConverter","abstract":false,"locations":[{"filename":"src/short_version/converter.cr","line_number":5,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L5"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"doc":"Converter to be used with `JSON::Serializable` to serialize a `ShortVersion`.","summary":"

Converter to be used with JSON::Serializable to serialize a ShortVersion.

","class_methods":[{"html_id":"from_json(value:JSON::PullParser):ShortVersion-class-method","name":"from_json","doc":"Reads a serialized ShortVersion by value from *pull*.\n\nSee `.to_json` for reference.\n\nRaises `JSON::ParseException` if the deserialization fails.","summary":"

Reads a serialized ShortVersion by value from pull.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"args_string":"(value : JSON::PullParser) : ShortVersion","args_html":"(value : JSON::PullParser) : ShortVersion","location":{"filename":"src/short_version/converter.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L11"},"def":{"name":"from_json","args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"return_type":"ShortVersion","visibility":"Public","body":"ShortVersion.parse(value.read_string)"}},{"html_id":"to_json(value:ShortVersion,json:JSON::Builder):Nil-class-method","name":"to_json","doc":"Serializes a `ShortVersion` value as a String from *value*.","summary":"

Serializes a ShortVersion value as a String from value.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(value : ShortVersion, json : JSON::Builder) : Nil","args_html":"(value : ShortVersion, json : JSON::Builder) : Nil","location":{"filename":"src/short_version/converter.cr","line_number":16,"url":"https://github.com/mraffonso/short_version/blob/081a4be4e61b51eb5320e7fc575c793cbda4dd4a/src/short_version/converter.cr#L16"},"def":{"name":"to_json","args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(value.to_s)"}}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"short_version","body":"# short_version\n\nA versioning scheme that uses only major and minor version numbers.\n\n[![CI](https://github.com/mraffonso/short_version/actions/workflows/ci.yml/badge.svg)](https://github.com/mraffonso/short_version/actions/workflows/ci.yml)\n[![Static Badge](https://img.shields.io/badge/Docs-GH_Pages-blue.svg)](https://mraffonso.github.io/short_version/)\n[![Release](https://img.shields.io/badge/Release-v0.1.0-blue.svg)](https://github.com/mraffonso/short_version/releases)\n[![Release](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/mraffonso/short_version/blob/main/LICENSE)\n\n## Features\n\nBased on [SemanticVersion] from the standard library and is comparable with and convertible to `SemanticVersion`. Includes a [SemanticVersion Extension] that adds convenience functionality to `SemanticVersion`. and a [ShortVersionConverter] for use with [JSON::Serializable].\n\n## Documentation\n\n* [Library API]\n\n## Installation\n\n1. Add the dependency to your `shard.yml`\n\n```yaml\ndependencies:\n short_version:\n github: mraffonso/short_version\n```\n\n2. Run `shards install`\n\n## Usage\n\nRequire the library.\n\n```crystal\nrequire \"short_version\"\n```\n\nCreate a `ShortVersion`.\n\n```crystal\nShortVersion.new(1, 1)\n# => ShortVersion(@major=1, @minor=1)\n\nShortVersion.new(major: 2, minor: 3)\n# => ShortVersion(@major=2, @minor=3)\n```\n\nOr `parse` from another format: `String` or `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.1\")\n# => ShortVersion(@major=1, @minor=1)\n\nsemver = SemanticVersion.new(1, 1, 2)\nShortVersion.parse(semver)\n# => ShortVersion(@major=1, @minor=1)\n```\n\nConvert `ShortVersion` to `SemanticVersion`. **Note**: By default patch version is `0` unless otherwise specified.\n\n```crystal\nshortver = ShortVersion.parse(\"1.1\")\n\nshortver.to_semver # Default patch version is 0\n# => SemanticVersion(@major=1, @minor=1, @patch=0, ...)\n\nshortver.to_semver(1) # Specify patch version\n# => SemanticVersion(@major=1, @minor=1, @patch=1, ...)\n```\n\nCompare `ShortVersion` <=> `ShortVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < ShortVersion.parse(\"1.3\") # => true\nShortVersion.parse(\"1.2\") == ShortVersion.parse(\"1.2\") # => true\nShortVersion.parse(\"1.2\") > ShortVersion.parse(\"1.1\") # => true\n```\n\nCompare `ShortVersion` <=> `SemanticVersion`.\n\n```crystal\nShortVersion.parse(\"1.2\") < SemanticVersion.parse(\"1.3.0\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") > SemanticVersion.parse(\"1.1.19\") # => true\n```\n\n### ShortVersionConverter (Optional)\n\nConverter to be used with [JSON::Serializable] to serialize a `ShortVersion`.\n\nRequire the converter.\n\n```crystal\nrequire \"short_version/converter\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\nAdd the converter to the JSON::Field decorator.\n\n```crystal\nstruct Example\n include JSON::Serializable\n\n def initialize(@short_version)\n end\n\n @[JSON::Field(converter: ShortVersionConverter)]\n property short_version : ShortVersion\nend\n```\n\nParse json string and convert to `ShortVersion`.\n\n```crystal\nexample = Example.from_json(\"{\\\"short_version\\\":\\\"1.2\\\"}\")\nexample.short_version # => ShortVersion(@major=1, @minor=2)\n```\n\nConvert `ShortVersion` to json string.\n\n```crystal\nshortver = ShortVersion.parse(\"1.0\")\nexample = Example.new(short_version: shortver)\nexample.to_json # => \"{\\\"short_version\\\":\\\"1.0\\\"}\"\n```\n\n### SemanticVersion Extension (Optional)\n\nExtending SemanticVersion is unnecessary but it adds some nice conveniences and may allow your code to flow more naturally.\n\n**Note**: It extends the `SemanticVersion` Struct from the standard library by adding a `to_shortver` instance method and `Comparable(ShortVersion)` functionality.\n\nRequire the extension.\n\n```crystal\nrequire \"short_version/extensions/semantic_version\"\n```\n\nConvert a `SemanticVersion` to `ShortVersion`.\n\n```crystal\nsemver = SemanticVersion.parse(\"1.2.3\")\nsemver.to_shortver # => ShortVersion(@major=1, @minor=2)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\n`SemanticVersion` parse `ShortVersion`.\n\n```crystal\nshortver = ShortVersion.new(1, 2)\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=2, @patch=0, ...)\n\n# Without the extension\nShortVersion.parse(semver) # => ShortVersion(@major=1, @minor=2)\n```\n\nCompare `SemanticVersion` <=> `ShortVersion`.\n\n```crystal\nSemanticVersion.parse(\"1.2.3\") < ShortVersion.parse(\"1.3\") # => true\nSemanticVersion.parse(\"1.2.3\") == ShortVersion.parse(\"1.2\") # => true\nSemanticVersion.parse(\"1.2.3\") > ShortVersion.parse(\"1.1\") # => true\n\n# Without the extension comparison must be reversed\nShortVersion.parse(\"1.1\") < SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.2\") == SemanticVersion.parse(\"1.2.3\") # => true\nShortVersion.parse(\"1.3\") > SemanticVersion.parse(\"1.2.3\") # => true\n```\n\n## Releasing\n\nCreating a realease is just tagging a git commit. The `./script/tag` shell script should be used for creating tags.\n\nThe current release workflow is:\n\n* update the version specified in `shard.yml`\n* commit with the message \"Bump version to x.x.x\"\n* push to main\n* run the tag script with no arguments `./script/tag`\n* confirm tag creation\n\nAnd that's it, a release is created.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Mario Affonso](https://github.com/mraffonso) - creator and maintainer\n\n[JSON::Serializable]: https://crystal-lang.org/api/JSON/Serializable.html\n[Library API]: https://mraffonso.github.io/short_version/\n[SemanticVersion]: https://crystal-lang.org/api/SemanticVersion.html\n[SemanticVersion Extension]: https://mraffonso.github.io/short_version/SemanticVersion.html\n[ShortVersionConverter]: https://mraffonso.github.io/short_version/ShortVersionConverter.html\n\n","program":{"html_id":"short_version/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"short_version","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"short_version/SemanticVersion","path":"SemanticVersion.html","kind":"struct","full_name":"SemanticVersion","name":"SemanticVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version/extensions/semantic_version.cr","line_number":1,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L1"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Semantic Versioning 2.0.0\n\nSee [https://semver.org/](https://semver.org/) for more information.","summary":"

Conforms to Semantic Versioning 2.0.0

","constructors":[{"html_id":"parse(str:ShortVersion):self-class-method","name":"parse","doc":"Parses a `SemanticVersion` from the given `ShortVersion`\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nshortver = ShortVersion.parse(\"1.23\")\nsemver = SemanticVersion.parse(shortver)\nsemver # => SemanticVersion(@major=1, @minor=23, @patch=0, ... )\n```","summary":"

Parses a SemanticVersion from the given ShortVersion

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"args_string":"(str : ShortVersion) : self","args_html":"(str : ShortVersion) : self","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":13,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L13"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"ShortVersion"}],"return_type":"self","visibility":"Public","body":"major = str.major\nminor = str.minor\nnew(major, minor, 0)\n"}}],"instance_methods":[{"html_id":"<=>(other:ShortVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with ShortVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.3\") # => -1\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.2\") # => 0\nSemanticVersion.parse(\"1.2.3\") <=> ShortVersion.parse(\"1.1\") # => 1\n```","summary":"

The comparison operator with ShortVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"args_string":"(other : ShortVersion) : Int32","args_html":"(other : ShortVersion) : Int32","location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":43,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L43"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"ShortVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"to_shortver-instance-method","name":"to_shortver","doc":"Returns the `ShortVersion` representation of this semantic version\n\n```\nrequire \"short_version/ext/semantic_version\"\n\nsemver = SemanticVersion.parse(\"0.39.3\")\nsemver.to_shortver # => ShortVersion(@major=0, @minor=39)\n```","summary":"

Returns the ShortVersion representation of this semantic version

","abstract":false,"location":{"filename":"src/short_version/extensions/semantic_version.cr","line_number":27,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/extensions/semantic_version.cr#L27"},"def":{"name":"to_shortver","visibility":"Public","body":"ShortVersion.new(major, minor)"}}]},{"html_id":"short_version/ShortVersion","path":"ShortVersion.html","kind":"struct","full_name":"ShortVersion","name":"ShortVersion","abstract":false,"superclass":{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"short_version/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"short_version/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/short_version.cr","line_number":6,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L6"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"short_version/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Conforms to Short Versioning\n\nSimilar to [Semantic Versioning](https://semver.org/) but only with major and minor version numbers.","summary":"

Conforms to Short Versioning

","constructors":[{"html_id":"new(major:Int,minor:Int)-class-method","name":"new","doc":"Creates a new `ShortVersion` instance with the given major and minor\nversion.","summary":"

Creates a new ShortVersion instance with the given major and minor version.

","abstract":false,"args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"args_string":"(major : Int, minor : Int)","args_html":"(major : Int, minor : Int)","location":{"filename":"src/short_version.cr","line_number":51,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L51"},"def":{"name":"new","args":[{"name":"major","external_name":"major","restriction":"Int"},{"name":"minor","external_name":"minor","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(major, minor)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"parse(version:String):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given short version string.\n\n```\nrequire \"short_version\"\"\n\nshortver = ShortVersion.parse(\"2.61\")\nshortver # => ShortVersion(@major=2, @minor=61)\n```\n\nRaises `ArgumentError` if *str* is not a short version.","summary":"

Parses a ShortVersion from the given short version string.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"String"}],"args_string":"(version : String) : self","args_html":"(version : String) : self","location":{"filename":"src/short_version.cr","line_number":26,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L26"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"String"}],"return_type":"self","visibility":"Public","body":"if m = version.match(/^(?\\d+)\\.(?\\d+)$/)\n major = m[\"major\"].to_i\n minor = m[\"minor\"].to_i\n new(major, minor)\nelse\n raise(ArgumentError.new(\"Not a short version: #{version.inspect}\"))\nend"}},{"html_id":"parse(version:SemanticVersion):self-class-method","name":"parse","doc":"Parses a `ShortVersion` from the given `SemanticVersion`.\n\n```\nrequire \"short_version\"\"\n\nsemver = SemanticVersion.parse(\"2.61.9\")\nshortver = ShortVersion.parse(semver)\nshortver # => ShortVersion(@major=2, @minor=61)\n```","summary":"

Parses a ShortVersion from the given SemanticVersion.

","abstract":false,"args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"args_string":"(version : SemanticVersion) : self","args_html":"(version : SemanticVersion) : self","location":{"filename":"src/short_version.cr","line_number":45,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L45"},"def":{"name":"parse","args":[{"name":"version","external_name":"version","restriction":"SemanticVersion"}],"return_type":"self","visibility":"Public","body":"new(version.major, version.minor)"}}],"instance_methods":[{"html_id":"<=>(other:self):Int32-instance-method","name":"<=>","doc":"The comparison operator with self.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"2.0\") # => -1\nShortVersion.parse(\"1.0\") <=> ShortVersion.parse(\"1.0\") # => 0\nShortVersion.parse(\"2.0\") <=> ShortVersion.parse(\"1.0\") # => 1\n```","summary":"

The comparison operator with self.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self) : Int32","args_html":"(other : self) : Int32","location":{"filename":"src/short_version.cr","line_number":128,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L128"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"self"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"<=>(other:SemanticVersion):Int32-instance-method","name":"<=>","doc":"The comparison operator with SemanticVersion.\n\nReturns `-1`, `0` or `1` depending on whether `self`'s version is lower than *other*'s,\nequal to *other*'s version or greater than *other*'s version.\n\n```\nrequire \"short_version\"\n\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"2.0.0\") # => -1\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"1.0.0\") # => 0\nShortVersion.parse(\"1.0\") <=> SemanticVersion.parse(\"0.1.0\") # => 1\n```","summary":"

The comparison operator with SemanticVersion.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"args_string":"(other : SemanticVersion) : Int32","args_html":"(other : SemanticVersion) : Int32","location":{"filename":"src/short_version.cr","line_number":149,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L149"},"def":{"name":"<=>","args":[{"name":"other","external_name":"other","restriction":"SemanticVersion"}],"return_type":"Int32","visibility":"Public","body":"r = major <=> other.major\nif r.zero?\nelse\n return r\nend\nr = minor <=> other.minor\nif r.zero?\nelse\n return r\nend\n0\n"}},{"html_id":"bump_major-instance-method","name":"bump_major","doc":"Returns a copy of the current version with a major bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_major # => ShortVersion(@major=2, @minor=0)\n```","summary":"

Returns a copy of the current version with a major bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":100,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L100"},"def":{"name":"bump_major","visibility":"Public","body":"copy_with(major: major + 1, minor: 0)"}},{"html_id":"bump_minor-instance-method","name":"bump_minor","doc":"Returns a copy of the current version with a minor bump.\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"1.1\")\nshortver.bump_minor # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a copy of the current version with a minor bump.

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":112,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L112"},"def":{"name":"bump_minor","visibility":"Public","body":"copy_with(minor: minor + 1)"}},{"html_id":"copy_with(major:Int32=@major,minor:Int32=@minor)-instance-method","name":"copy_with","doc":"Returns a new `ShortVersion` created with the specified parts. The\ndefault for each part is its current value.\n\n```\nrequire \"short_version\"\n\ncurrent_version = ShortVersion.parse(\"1.1\")\ncurrent_version.copy_with(minor: 2) # => ShortVersion(@major=1, @minor=2)\n```","summary":"

Returns a new ShortVersion created with the specified parts.

","abstract":false,"args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"args_string":"(major : Int32 = @major, minor : Int32 = @minor)","args_html":"(major : Int32 = @major, minor : Int32 = @minor)","location":{"filename":"src/short_version.cr","line_number":88,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L88"},"def":{"name":"copy_with","args":[{"name":"major","default_value":"@major","external_name":"major","restriction":"Int32"},{"name":"minor","default_value":"@minor","external_name":"minor","restriction":"Int32"}],"visibility":"Public","body":"ShortVersion.new(major, minor)"}},{"html_id":"major:Int32-instance-method","name":"major","doc":"The major version of this short version","summary":"

The major version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L11"},"def":{"name":"major","return_type":"Int32","visibility":"Public","body":"@major"}},{"html_id":"minor:Int32-instance-method","name":"minor","doc":"The minor version of this short version","summary":"

The minor version of this short version

","abstract":false,"location":{"filename":"src/short_version.cr","line_number":14,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L14"},"def":{"name":"minor","return_type":"Int32","visibility":"Public","body":"@minor"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Returns the string representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_s # => \"0.27\"\n```","summary":"

Returns the string representation of this short version

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/short_version.cr","line_number":62,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L62"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"((io << major) << '.') << minor"}},{"html_id":"to_semver(patch:Int=0):SemanticVersion-instance-method","name":"to_semver","doc":"Returns the `SemanticVersion` representation of this short version\n\n```\nrequire \"short_version\"\n\nshortver = ShortVersion.parse(\"0.27\")\nshortver.to_semver # => SemanticVersion(@major=0, @minor=27, @patch=0, ...)\nshortver.to_semver(1) # => SemanticVersion(@major=0, @minor=27, @patch=1, ...)\n```","summary":"

Returns the SemanticVersion representation of this short version

","abstract":false,"args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"args_string":"(patch : Int = 0) : SemanticVersion","args_html":"(patch : Int = 0) : SemanticVersion","location":{"filename":"src/short_version.cr","line_number":75,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version.cr#L75"},"def":{"name":"to_semver","args":[{"name":"patch","default_value":"0","external_name":"patch","restriction":"Int"}],"return_type":"SemanticVersion","visibility":"Public","body":"SemanticVersion.new(major: major, minor: minor, patch: patch)"}}]},{"html_id":"short_version/ShortVersionConverter","path":"ShortVersionConverter.html","kind":"module","full_name":"ShortVersionConverter","name":"ShortVersionConverter","abstract":false,"locations":[{"filename":"src/short_version/converter.cr","line_number":5,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L5"}],"repository_name":"short_version","program":false,"enum":false,"alias":false,"const":false,"doc":"Converter to be used with `JSON::Serializable` to serialize a `ShortVersion`.","summary":"

Converter to be used with JSON::Serializable to serialize a ShortVersion.

","class_methods":[{"html_id":"from_json(value:JSON::PullParser):ShortVersion-class-method","name":"from_json","doc":"Reads a serialized ShortVersion by value from *pull*.\n\nSee `.to_json` for reference.\n\nRaises `JSON::ParseException` if the deserialization fails.","summary":"

Reads a serialized ShortVersion by value from pull.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"args_string":"(value : JSON::PullParser) : ShortVersion","args_html":"(value : JSON::PullParser) : ShortVersion","location":{"filename":"src/short_version/converter.cr","line_number":11,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L11"},"def":{"name":"from_json","args":[{"name":"value","external_name":"value","restriction":"JSON::PullParser"}],"return_type":"ShortVersion","visibility":"Public","body":"ShortVersion.parse(value.read_string)"}},{"html_id":"to_json(value:ShortVersion,json:JSON::Builder):Nil-class-method","name":"to_json","doc":"Serializes a `ShortVersion` value as a String from *value*.","summary":"

Serializes a ShortVersion value as a String from value.

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(value : ShortVersion, json : JSON::Builder) : Nil","args_html":"(value : ShortVersion, json : JSON::Builder) : Nil","location":{"filename":"src/short_version/converter.cr","line_number":16,"url":"https://github.com/mraffonso/short_version/blob/e8953379e0259aa5d310a8124060b7563e3750d1/src/short_version/converter.cr#L16"},"def":{"name":"to_json","args":[{"name":"value","external_name":"value","restriction":"ShortVersion"},{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(value.to_s)"}}]}]}}) \ No newline at end of file