Sha256: 79dd8ee4d7895b9b23022b3cf2338aa75fd4adf3aded3dcfdce644c34505f809

Contents?: true

Size: 333 Bytes

Versions: 1

Compression:

Stored size: 333 Bytes

Contents

module Mastermind
  class Result
    attr_accessor :line
    def initialize(line)
      @line = line
    end

    def <=>(other)
      score <=> other.score
    end

    def score
      [rounds, seconds]
    end

    def rounds
      @line[/\d+ rounds/].to_i
    end

    def seconds
      @line[/\d+ seconds/].to_i
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mastermind_adeybee-0.1.4 lib/mastermind/result.rb