Sha256: 84a685157aa5905e390a6035115ac18a630115e65c133a42371b8d5d730a67a0

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

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

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

      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

2 entries across 2 versions & 1 rubygems

Version Path
shivers-0.6.0.pre.7 lib/shivers/parts/numeric.rb
shivers-0.6.0.pre.6 lib/shivers/parts/numeric.rb