Sha256: 76a6d3abca07b0027be62282e928c6aba295c886e698592eb7eacf5fa6f25835
Contents?: true
Size: 540 Bytes
Versions: 1
Compression:
Stored size: 540 Bytes
Contents
module ProjectEulerCli class Problem attr_accessor :title, :published, :solved_by, :difficulty @@all = [] def initialize @@all << self end def self.[](id) @@all[id - 1] end def self.[]=(id, value) @@all[id - 1] = value end def self.total @@all.size end # call-seq: # get_page(id) => page # # Returns page number based on the ID of the problem. The recent page is # considered page 0. def self.page(id) id.between?(1, total - 10) ? (id - 1) / Page::LENGTH + 1 : 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
project_euler_cli-1.3.0 | lib/project_euler_cli/problem.rb |