Sha256: 5d7ec312d5b82f6e49b2a46e7147e3696ba80f4f29294132b0504edc258a5f04

Contents?: true

Size: 637 Bytes

Versions: 3

Compression:

Stored size: 637 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

      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.hash ^ state.hash
      end

      def state
        []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shivers-0.6.0.pre.5 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.4 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.3 lib/shivers/parts/numeric.rb