class Fortune::P_abstract
Permutations
Attributes
k[RW]
n[RW]
value[RW]
Public Class Methods
calc(n)
click to toggle source
# File lib/fortune/p_abstract.rb, line 14 def self.calc(n) self.new(n).value end
new(h, format = {:n => :elements, :k => :select})
click to toggle source
# File lib/fortune/p_abstract.rb, line 7 def initialize(h, format = {:n => :elements, :k => :select}) raise ArgumentError.new("Error: arguments should be hash") unless h.is_a?(Hash) self.n = h[:n] || h[format[:n]] self.k = h[:k] || h[format[:k]] self.value = h end