Class: Class

Inherits:
Object show all
Defined in:
lib/algebra/sets-system.rb

Instance Method Summary collapse

Instance Method Details

#use_setnameObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/algebra/sets-system.rb', line 2

def use_setname
  const = 'C__names__'
  evalstr = "  class \#{name}\n    raise '\#{const} is already defined.' if defined? \#{const}\n    \n    \#{const} = {}\n    \n    raise 'setname is already defined.' if defined? setname\n\n    def setname(s)\n  \#{const}[self] = s\n    end\n    \n    alias inspect! inspect\n    \n    def inspect\n  \#{const}[self] || super\n    end\n    \n  end\n  __END_OF_EVAL__\n  eval(evalstr, TOPLEVEL_BINDING)\nend\n"