Module: AArch64::ClassGen

Defined in:
lib/aarch64/utils.rb

Class Method Summary collapse

Class Method Details

.pos(*names) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/aarch64/utils.rb', line 5

def self.pos *names
  Class.new do
    attr_reader(*names)
    sig = names.map { "#{_1}" }.join(", ")
    init = names.map { "@#{_1} = #{_1}" }.join(";")
    class_eval("def initialize #{sig}; #{init}; end")
  end
end