Sha256: 8469193448c4bce59fb7ce4c47e7ec832e444ada4d9311eb656858682b2dd220

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 Bytes

Contents

#!/usr/bin/env ruby
require 'exalted_math/node/node'
require 'exalted_math/node/list'
module ExaltedMath
  class Node
    class Minimum < List
      attr_reader :count

      def initialize(nodes=[],count)
        super
        @count = count
      end

      def values(context={})
        nodes.map { |node| node.value(context) }.sort.slice(0, count)
      end

      def ==(o)
        return false unless super
        count == o.count
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exalted_math-0.2.2 lib/exalted_math/node/minimum.rb
exalted_math-0.2.1 lib/exalted_math/node/minimum.rb
exalted_math-0.2.0 lib/exalted_math/node/minimum.rb