Upgrade to Pro — share decks privately, control downloads, hide ads and more …

magic-comment-magic.pdf

 magic-comment-magic.pdf

Koichi ITO

July 18, 2019
Tweet

More Decks by Koichi ITO

Other Decks in Programming

Transcript

  1. !LPJD w *DPNFGSPN5PLZP +BQBO w *`NXPSLJOHJO&4. JOD w 3VCP$PQDPNNJUUFS w

    "30SBDMFFOIBODFE BEBQUFSDPNNJUUFS w 3VCZ,BJHJTQFBLFS w 3VCZ,BJHJ-5FS
  2. 044

  3. #BEPSEFS # frozen_string_literal: true # encoding: ascii p [''.frozen?, ''.encoding]

    #=> [true, #<Encoding:UTF-8>] *UFYQFDUFE"4$**FODPEJOHCVUBDUVBMMZ65'FODPEJOH
  4. (PPEPSEFS #!/usr/bin/env ruby # encoding: ascii # frozen_string_literal: true p

    [''.frozen?, ''.encoding] #=> [true, #<Encoding:US-ASCII>]
  5. "OPGGFOTFPG 3VCP$PQPDDVST # frozen_string_literal: true x = { encoding: Encoding::SJIS

    } puts x test.rb:3:1: W: Lint/ OrderedMagicComments: The encoding magic comment should precede all other magic comments.
  6. "TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii ^^^^^^^^^^^^^^^ )BTI x = {

    encoding: Encoding::SJIS } ^^^^^^^^^^^^^^^^^^^^^^^^