class CelluloidPubsub::GemVersionParser
class used for parsing gem versions @!attribute [r] version
@return [String, Integer] version that needs parsing
@!attribute [r] options
@return [Hash] The additional options for parsing the version
Attributes
options[R]
version[R]
Public Class Methods
new(version, options = {})
click to toggle source
receives the version and the additional options
@param [String, Integer] version the version that needs parsing @param [Hash] options The additional options for parsing the version
@return [void]
@api public
:nocov:
# File lib/celluloid_pubsub/gem_version_parser.rb, line 23 def initialize(version, options = {}) @version = version @options = options.is_a?(Hash) ? options : {} end
Public Instance Methods
number_with_single_decimal_point()
click to toggle source
pops from the version array elements until its size is 2 @return [void]
@api public
# File lib/celluloid_pubsub/gem_version_parser.rb, line 43 def number_with_single_decimal_point @version_array.pop until @version_array.size == 2 end
parsed_number()
click to toggle source
parses the version and returns the version with a single decimal point by default
@return [Float]
@api public
# File lib/celluloid_pubsub/gem_version_parser.rb, line 32 def parsed_number return 0 if @version.blank? @version_array = @version.to_s.split('.') number_with_single_decimal_point if @version_array.size > 2 @version_array.join('.').to_f end