Class: ECC::FiniteField

Inherits:
Object
  • Object
show all
Defined in:
lib/elliptic-lite/field.rb

Defined Under Namespace

Classes: Element

Class Method Summary collapse

Class Method Details

.build_class(prime) ⇒ Object Also known as: new

meta-programming “macro” - build class (on the fly)

todo/check:  rename max to modulus or prime or ?? - why? why not?
todo/check:  memoize generated classes ( do NOT regenerate duplicates) - why? why not?


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/elliptic-lite/field.rb', line 12

def self.build_class( prime )
  klass = Class.new( Element )

  klass.class_eval( <<RUBY )
  def self.prime
     #{prime}
  end
RUBY

  klass
end