Sha256: 2bccc889176f1f69f7a01af00358c31fd4b45d9457a0e5face257a7cfd75ced9

Contents?: true

Size: 567 Bytes

Versions: 5

Compression:

Stored size: 567 Bytes

Contents

module Lottery
  module LotteryHelper
    def draw(max = 0, amount = 0)
      [*1..max].sample(amount).sort
    end

    def make_hash(arr1, arr2 = nil)
      { first: arr1, second: arr2 }
    end
  end

  module LotteryPPrint

    def pprint(first_name: 'Numbers', second_name: 'Lucky Numbers')
      printf "%s: %s ", first_name, self[:first]
      if self[:second].nil?
        newline
      else
        printf "%s: %s\n", second_name, self[:second]
      end
    end

    def newline
      puts
    end

  end
end

class Hash
  include Lottery::LotteryPPrint
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lottery-0.0.5 lib/lottery/helper.rb
lottery-0.0.4 lib/lottery/helper.rb
lottery-0.0.3 lib/lottery/helper.rb
lottery-0.0.2 lib/lottery/helper.rb
lottery-0.0.1 lib/lottery/helper.rb