class ProjectEulerCli::Problem

Attributes

difficulty[RW]
published[RW]
solved_by[RW]
title[RW]

Public Class Methods

[](id) click to toggle source
# File lib/project_euler_cli/problem.rb, line 12
def self.[](id)
  @@all[id - 1]
end
[]=(id, value) click to toggle source
# File lib/project_euler_cli/problem.rb, line 16
def self.[]=(id, value)
  @@all[id - 1] = value
end
new() click to toggle source
# File lib/project_euler_cli/problem.rb, line 8
def initialize
  @@all << self
end
get_page(id) → page click to toggle source

Returns page number based on the ID of the problem. The recent page is considered page 0.

# File lib/project_euler_cli/problem.rb, line 29
def self.page(id)
  id.between?(1, total - 10) ? (id - 1) / Page::LENGTH + 1 : 0
end
total() click to toggle source
# File lib/project_euler_cli/problem.rb, line 20
def self.total
  @@all.size
end