I am looking for a list of all the magic instructions in Ruby.
For example:
#!/usr/bin/ruby -w
# encoding: windows-1252
# warn_indent: false
# frozen_string_literal: true
I just got one link mentioning some of them.
I am looking for a list of all the magic instructions in Ruby.
For example:
#!/usr/bin/ruby -w
# encoding: windows-1252
# warn_indent: false
# frozen_string_literal: true
I just got one link mentioning some of them.
The link you mention there has a link to the Ruby source where these are defined:
static const struct magic_comment magic_comments[] = {
{"coding", magic_comment_encoding, parser_encode_length},
{"encoding", magic_comment_encoding, parser_encode_length},
{"frozen_string_literal", parser_set_compile_option_flag},
{"warn_indent", parser_set_token_info},
# if WARN_PAST_SCOPE
{"warn_past_scope", parser_set_past_scope},
# endif
};
One of these is gated based on a #define, so it may be a feature that's incomplete or yet to ship, perhaps held back for Ruby 2.7 or 3.0.