Sha256: 69111e686f57c87853fec508b1099fd20390e9c99d4aebbfc335e48a574959ec

Contents?: true

Size: 374 Bytes

Versions: 4

Compression:

Stored size: 374 Bytes

Contents

module Daigaku
  class Congratulator
    def self.message
      new.message
    end

    def message
      lines[random_value]
    end

    private

    def lines
      @lines ||= Terminal.text(:congratulations).lines.map(&:strip).compact
    end

    def random_value
      rand(0..lines_count)
    end

    def lines_count
      [lines.count - 1, 0].max
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daigaku-1.0.0 lib/daigaku/congratulator.rb
daigaku-0.6.0 lib/daigaku/congratulator.rb
daigaku-0.5.0 lib/daigaku/congratulator.rb
daigaku-0.4.0 lib/daigaku/congratulator.rb