Sha256: 86d701eb0da47c8790e9276aab4ff3e683dcae919b658ed42d23bba6ee81d303

Contents?: true

Size: 712 Bytes

Versions: 8

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

require_relative 'mixins/multivaluable'
require_relative '../value_equality'

module Shivers
  module Parts
    class Numeric
      include ValueEquality
      include Mixins::Multivaluable

      def initialize(_ = {}); end # rubocop:disable Style/RedundantInitialize, Lint/RedundantCopDisableDirective

      def matcher
        /0|[1-9]\d*/
      end

      def convert(value)
        value&.to_i
      end

      def capturable?
        true
      end

      def ==(other)
        other.class == self.class && other.state == state
      end

      alias eql? ==

      def hash
        [self.class, state].hash
      end

      def state
        []
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shivers-0.6.0.pre.15 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.14 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.13 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.12 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.11 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.10 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.9 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.8 lib/shivers/parts/numeric.rb