During this trying time when no one can get their techie catchwords to
stick to the refrigerator no matter how hard they slap it with the
enchanted magnetic spatula, it’s good to know that the contrived phrases
really do fly, graceful and unclasped and bearing north toward chilled
shrimp.

# File 'lib/standard/facets/cli.rb', line 7defcli(*args)opts=args.popargv=(args.first||ARGV).dupargs=[]# Split option aliases.
opts=opts.inject({})do|h,(k,v)|k.to_s.split(/\s+/).each{|o|h[o]=v};hend# Convert single dash flags into multiple flags.
argv=argv.inject([])do|a,v|ifv[0,1]=='-'&&v[1,1]!='-'a.concat(v[1..-1].chars.map{|c|"-#{c}"})elsea<<vendaendwhileargv.any?item=argv.shiftflag=opts[item]ifflag# Work around lambda semantics in 1.8.7.
arity=[flag.arity,0].max# Raise if there are not enough parameters
# available for the flag.
ifargv.size<arityraiseArgumentErrorend# Call the lambda with N items from argv,
# where N is the lambda's arity.
flag.call(*argv.shift(arity))else# Collect the items that don't correspond to
# flags.
args<<itemendendargsend

Forces the result of a promise to be computed (if necessary) and returns
the bare result object. Once evaluated, the result of the promise will be
cached. Nested promises will be evaluated together, until the first
non-promise result.

If called on a value that is not a promise, it will simply return it.

218
219
220
221
222
223
224

# File 'lib/core/facets/lazy.rb', line 218defdemand(promise)ifpromise.respond_to?:__result__promise.__result__else# not really a promise
promiseendend

During this trying time when no one can get their techie catchwords to
stick to the refrigerator no matter how hard they slap it with the
enchanted magnetic spatula, it’s good to know that the contrived phrases
really do fly, graceful and unclasped and bearing north toward chilled
shrimp. I know what my Hallowe’en pumpkin is going to say.

NOTE: This method is not a common core extension and is not loaded
automatically when using `require 'facets'`.

# File 'lib/core/facets/kernel/hierarchical_send.rb', line 28defhierarchical_send(method_name,*args,&block)method_name=method_name.to_sifRUBY_VERSION<'1.9'this=selfself.class.hierarchicallydo|anc|## is there really no better way to check for the method?
ifanc.instance_methods(false).include?(method_name)oranc.public_instance_methods(false).include?(method_name)oranc.private_instance_methods(false).include?(method_name)oranc.protected_instance_methods(false).include?(method_name)im=anc.instance_method(method_name)##im.arity == 0 ? im.bind(this).call(&block) : im.bind(this).call(*args, &block)
im.bind(this).call(*args,&block)endendend

#present? ⇒ Boolean

The promise() function is used together with demand() to implement lazy
evaluation. It returns a promise to evaluate the provided block at a
future time. Evaluation can be demanded and the block's result
obtained via the demand() function.

Implicit evaluation is also supported: the first message sent to it will
demand evaluation, after which that message and any subsequent messages
will be forwarded to the result object.

As an aid to circular programming, the block will be passed a promise for
its own result when it is evaluated. Be careful not to force that promise
during the computation, lest the computation diverge.

Require a pattern of files relatvie to the current file. This makes is easy
to require an entire directory, for instance:

require_all'core_ext/*'

NOTE: This method used to allow glob-based requires from the $LOAD_PATH,
but this was deprecated in favor of relative requiring only, as it is
consider the typical usecase, and globbing from the $LOAD_PATH is a bit
dangerous. Better options exist for globbing the $LOAD_PATH such as the
plugins gem.

Technically, #returning probably should force the return of the stated
object irregardless of any return statements that might appear within
it's block. This might differentiate #returning from #with, however it
also would require implementation in Ruby itself.

Calling Kernel#trap() by itself will replace any previously registered
handler code. Kernel#trap_chain(), on the other hand, will add the block
you supply to the existing “list” of registered handler blocks. Similar to
the way Kernel#at_exit() works, Kernel#trap_chain() will prepend the given
block to the call chain for the given signal_name. When the signal occurs,
your block will be executed first and then the previously registered
handler will be invoked. This can be called repeatedly to create a “chain”
of handlers.

NOTE: This method is not a common core extension and is not loaded
automatically when using require 'facets'.