lib/version_gem/api.rb in version_gem-1.1.0 vs lib/version_gem/api.rb in version_gem-1.1.1

- old
+ new

@@ -9,39 +9,39 @@ # The major version # # @return [Integer] def major - _to_a[0].to_i + @major ||= _to_a[0].to_i end # The minor version # # @return [Integer] def minor - _to_a[1].to_i + @minor ||= _to_a[1].to_i end # The patch version # # @return [Integer] def patch - _to_a[2].to_i + @patch ||= _to_a[2].to_i end # The pre-release version, if any # # @return [String, NilClass] def pre - _to_a[3] + @pre ||= _to_a[3] end # The version number as a hash # # @return [Hash] def to_h - { + @to_h ||= { major: major, minor: minor, patch: patch, pre: pre } @@ -49,18 +49,18 @@ # The version number as an array of cast values # # @return [Array<[Integer, String, NilClass]>] def to_a - [major, minor, patch, pre] + @to_a ||= [major, minor, patch, pre] end private # The version number as an array of strings # # @return [Array<String>] def _to_a - self::VERSION.split('.') + @_to_a = self::VERSION.split('.') end end end