class Trustworthy::Key
Attributes
x[R]
y[R]
Public Class Methods
create(slope, intercept)
click to toggle source
# File lib/trustworthy/key.rb, line 5 def self.create(slope, intercept) x = Trustworthy::Random.number y = slope * x + intercept new(x, y) end
create_from_string(str)
click to toggle source
# File lib/trustworthy/key.rb, line 11 def self.create_from_string(str) x, y = str.split(',').map { |n| BigDecimal(n) } Trustworthy::Key.new(x, y) end
new(x, y)
click to toggle source
# File lib/trustworthy/key.rb, line 16 def initialize(x, y) @x = x @y = y end
Public Instance Methods
to_s()
click to toggle source
# File lib/trustworthy/key.rb, line 21 def to_s "#{x.to_s('F')},#{y.to_s('F')}" end