What parameters for inline block (<< - BLOCK, param1, param2) mean?
I am reading some source code https://github.com/plataformatec/devise and found that the line of code is:
class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1
What are the parameters __FILE__
and __LINE__ + 1
to block the ad (which changes with respect to the inline box without these options)?
https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/url_helpers.rb#L47
thank
source share
These parameters are specific to class_eval , not to document here . It is generally accepted practice that an error that can raise the circled code will be shown with a link to the current file and with the correct line number.
source share
As an alternative example showing how HEREDOCs work, I wrote in IRB the other day:
require 'nokogiri' doc = Nokogiri.XML(<<ENDXML,&:noblanks) ...gobs and gobs of pasted xml... ENDXML
Even crazier is this legal syntax for passing multiple HEREDOC lines at once:
p( <<END1, <<-END2, <<END3 ) This indented text is part of the first parameter, END1 END1 And this text is part of param2 whose ending sigil may be indented END2 and finally this text is part of the third parameter END3 #=> " This indented text is part of\n the first parameter, END1\n" #=> "And this text is part of param2\n whose ending sigil may be indented\n" #=> "and finally this text\nis part of\nthe third parameter\n"
source share