Could somebody please explain this piece of Ruby code:
def add_spec_path_to(args) # :nodoc:
args << {} unless Hash === args.last
args.last[:spec_pa
In a little shorter way:
def add_spec_path_to(args) # :nodoc:
...
# Append an empty hash to args UNLESS the last arg is a hash.. in which case do nothing
args << {} unless Hash === args.last # so we need a hash. If it is not there, make an empty one and put it there.
...
#if args.last[:spec_path] equals nil or false, set it to caller(0)[2]...
#so inside that hash from the first part, if :spec_path is not there, create it by using caller(0)[2].
args.last[:spec_path] ||= caller(0)[2]
...
end