Module: Hornetseye::MultiArrayConstructor

Included in:
MultiArray, Sequence
Defined in:
lib/multiarray/shortcuts.rb

Overview

Module with meta-programming methods for creating constructor shortcut methods

Class Method Summary collapse

Class Method Details

.constructor_shortcut(target) ⇒ Proc

Meta-programming method for creating constructor shortcut methods

Parameters:

  • target (Class)

    Element-type to create constructor shortcut for.

Returns:

  • (Proc)

    The new method.



30
31
32
33
34
# File 'lib/multiarray/shortcuts.rb', line 30

def constructor_shortcut( target )
  define_method target.to_s.downcase do |*args|
    new target, *args
  end
end