class Lab42::Function::Placeholder

Attributes

arg_number[R]

Public Class Methods

make(n) click to toggle source
# File lib/lab42/function/placeholder.rb, line 6
def make n
  return cache.fetch(n){ cache[n] = new(n) }
end
new(n) click to toggle source
# File lib/lab42/function/placeholder.rb, line 29
def initialize n
  raise ArgumentError, "only positive argument numbers are allowed, not #{n}" unless n.positive?
  @arg_number = n
end

Private Class Methods

cache() click to toggle source

Lazy Values


# File lib/lab42/function/placeholder.rb, line 19
def cache
   @__cache__ ||= {}
end
new(n) click to toggle source
Calls superclass method
# File lib/lab42/function/placeholder.rb, line 13
def new n
  super
end