This whole method requires a rewrite...but to answer your question, why wouldn't the following work?
my_proc = ->(){ fill_me_with_something }
my_var ||= my_proc.call
raise StandardError if my_var.nil?
Editing my answer to better answer the question...The syntax:
my_proc = ->(a,b){ a + b }
Is another way to express a block, for all intents and purposes:
my_proc(1, 5) #=> 6
You can also express Procs in this format:
my_proc = Proc.new{ |a, b| a + b }
The advantage of using a Proc is that you can set your block-like behavior to some variable, and then invoke call
on that proc whenever you want, which, in your case, is when some other variable is blank.