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

The Architecture of Haml 5

The Architecture of Haml 5

Takashi Kokubun

July 29, 2017
Tweet

More Decks by Takashi Kokubun

Other Decks in Programming

Transcript

  1. T H E A R C H I T E

    C T U R E O F H A M L 5 @ k 0 k u b u n / To k y u R u b y ձ ٞ 1 1
  2. ࣗ ݾ ঺ հ • GitHub, Twitter: @k0kubun • Treasure

    Data ॴଐ • !!ੵۃ࠾༻த!! • ERB, Hamlͷϝϯςφ • trunkͷERBΛErubi, ErubisΑΓ଎ͨ͘͠ • Haml 5Λ3ഒ଎ͨ͘͠
  3. ࣗ ݾ ঺ հ • GitHub, Twitter: @k0kubun • Treasure

    Data ॴଐ • !!ੵۃ࠾༻த!! • ERB, Hamlͷϝϯςφ • trunkͷERBΛErubi, ErubisΑΓ଎ͨ͘͠ • Haml 5Λ3ഒ଎ͨ͘͠ ← ͜Εͷɺϒϩάʹॻ͔ͳ͔ͬͨ࿩
  4. ࠓ ೔ ࿩ ͢ ͜ ͱ • Haml 4 →

    5 ʹ͓͚Δઃܭมߋ • Haml Attributeͷੜ੒ίʔυ͕͍͔ʹߴ଎͔ • Tokyuʹ޲͚ͯߋʹHamlΛ଎͖ͯͨ͘͠࿩ • Haml 6Ͱ΍Γ͍ͨ͜ͱ
  5. H A M L 4 → 5 ʹ ͓ ͚Δ

    ઃ ܭ ม ߋ T H E A R C H I T E C T U R E O F H A M L 5
  6. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L
  7. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L A S T ύʔε
  8. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ύʔε
  9. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ύʔε ෦ ෼ త ί ʔ υ ੜ ੒ + ί ϯύ Πϧ
  10. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ಠ ࣗ ͷ த ؒ ද ݱ ( ඍ ົ ʹ ࠷ ద Խ ) ύʔε ෦ ෼ త ί ʔ υ ੜ ੒ + ί ϯύ Πϧ খ ͞ ͳ ཻ ౓ Ͱ ࠷ ద Խ
  11. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ಠ ࣗ ͷ த ؒ ද ݱ ( ඍ ົ ʹ ࠷ ద Խ ) ੜ ੒ ί ʔ υ ( R u b y ) ύʔε ෦ ෼ త ί ʔ υ ੜ ੒ + ί ϯύ Πϧ খ ͞ ͳ ཻ ౓ Ͱ ࠷ ద Խ ί ʔ υ ੜ ੒
  12. H a m l 4 · Ͱ ͷ ί ϯύΠϧϓ

    ϩ η ε • ίϯύΠϥ͕ύʔεҎ֎શ෦΍ͬͯΔ • ίʔυ͕௕ͯ͘ݟ௨͕͠ѱ͍ • ෳࡶͳίϯύΠϧΛ΍Ζ͏ͱͯ͠΋શͯͷίʔυੜ ੒΍࠷దԽΛͦͷ৔Ͱ΍Βͳ͍ͱ͍͚ͳ͍ͷͰେม
  13. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ύʔε
  14. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ύʔε ै དྷ ͷ ί ϯύΠϧύ ε
  15. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) Te m p l e த ؒ ද ݱ ύʔε ै དྷ ͷ ί ϯύΠϧύ ε ( ޙ ํ ޓ ׵ ੑ ͷ ͨ Ί ࢒ ͢ ) ৽ ͨ ͳ ί ϯύΠϧύ ε ( ຊ ౰ ʹ ඞ ཁ ͳ ͱ ͜ Ζ ͩ ͚ Ϧ ϓ Ϩ ʔε ) +
  16. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) Te m p l e த ؒ ද ݱ ύʔε ม ׵
  17. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) Te m p l e த ؒ ද ݱ Te m p l e ϑΟϧ λ ʔ Te m p l e த ؒ ද ݱ ύʔε ม ׵
  18. H a m l 5 ͷ ί ϯύΠϧϓ ϩ η

    ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) Te m p l e த ؒ ද ݱ Te m p l e ϑΟϧ λ ʔ Te m p l e த ؒ ද ݱ Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) ύʔε ม ׵
  19. ί ʔ υ δΣω Ϩ ʔ λ H a m

    l 5 ͷ ί ϯύΠϧϓ ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) Te m p l e த ؒ ද ݱ Te m p l e ϑΟϧ λ ʔ Te m p l e த ؒ ද ݱ Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) ύʔε ม ׵
  20. ί ʔ υ δΣω Ϩ ʔ λ H a m

    l 5 ͷ ί ϯύΠϧϓ ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ੜ ੒ ί ʔ υ ( R u b y ) Te m p l e த ؒ ද ݱ Te m p l e ϑΟϧ λ ʔ Te m p l e த ؒ ද ݱ Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) ύʔε ί ʔ υ ੜ ੒ ม ׵
  21. • ίϯύΠϥͷ੹຿͕ݮΓݟ௨͕͠Α͘ͳͬͨ • 540ߦˠ333ߦ • ඞཁʹԠͯ͡ίʔυੜ੒ͱ࠷దԽͷίʔυ͕෼཭Ͱ͖Δঢ়ଶ ʹͳͬͨ • Ͱ΋ෆཁͳ෦෼Λແବʹॻ͖׵͑ͨΓ͸ͯ͠ͳ͍ •

    ͜ΕͰ࠷దԽ͞Εͨίʔυੜ੒͕΍Γ΍͘͢ͳͬͨͷͰɺ ϘτϧωοΫͰ͋ΔHaml Attributeͷ෦෼Λ׬શϦϓϨʔε H a m l 5 ͷ ί ϯύΠϧϓ ϩ η ε
  22. • ίϯύΠϥͷ੹຿͕ݮΓݟ௨͕͠Α͘ͳͬͨ • 540ߦˠ333ߦ • ඞཁʹԠͯ͡ίʔυੜ੒ͱ࠷దԽͷίʔυ͕෼཭Ͱ͖Δঢ়ଶ ʹͳͬͨ • Ͱ΋ෆཁͳ෦෼Λແବʹॻ͖׵͑ͨΓ͸ͯ͠ͳ͍ •

    ͜ΕͰ࠷దԽ͞Εͨίʔυੜ੒͕΍Γ΍͘͢ͳͬͨͷͰɺ ϘτϧωοΫͰ͋ΔHaml Attributeͷ෦෼Λ׬શϦϓϨʔε H a m l 5 ͷ ί ϯύΠϧϓ ϩ η ε
  23. ί ʔ υ δΣω Ϩ ʔ λ H a m

    l 5 ͷ ί ϯύΠϧϓ ϩ η ε ύʔ α ʔ H A M L A S T ί ϯύ Π ϥ A S T ಠ ࣗ ͷ த ؒ ද ݱ ( ੜ ੒ ί ʔ υ ؚ Ή ) ੜ ੒ ί ʔ υ ( R u b y ) Te m p l e த ؒ ද ݱ Te m p l e ϑΟϧ λ ʔ Te m p l e த ؒ ද ݱ Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) Te m p l e த ؒ ද ݱ ( ෦ ෼ త ͳ ί ʔ υ Խ & ࠷ ద Խ ) ύʔε ί ʔ υ ੜ ੒ ม ׵ H a m l a t t r i b u t e ͸ શ ෦ ͜ Ε ʹ ͠ ͨ
  24. H A M L AT T R I B U

    T E ͷ ੜ ੒ ί ʔ υ ͕ ͍ ͔ ʹ ߴ ଎ ͔ T H E A R C H I T E C T U R E O F H A M L 5
  25. H a m l A t t r i b

    u t e ͱ ͸ !
  26. H a m l A t t r i b

    u t e ࢓ ༷ 1 • .foo Ͱclass, #bar Ͱid͕ఆٛͰ͖Δ
  27. H a m l A t t r i b

    u t e ࢓ ༷ 2 • %div(foo=“bar”) ͷΑ͏ʹAttributeΛఆٛՄೳ
  28. H a m l A t t r i b

    u t e ࢓ ༷ 3 • %div{ foo: “bar” } Ͱ΋AttributeΛఆٛͰ͖Δ
  29. H a m l A t t r i b

    u t e ࢓ ༷ 4 • %div{ hash1, hash2, hash3 } ͱෳ਺ͷHashͰ΋౉ͤΔ
  30. H a m l A t t r i b

    u t e ࢓ ༷ 5 • %div[object] ͱ΍Δͱಈతʹid, classΛੜ੒ͯ͠౉ͤΔ
  31. H a m l A t t r i b

    u t e ࢓ ༷ 6 • ஋ʹnil, false ͕౉ͬͯ͘ΔͱAttribute͕ফ͑Δ H a m l i t ͸ ϒʔ Ϧ Ξ ϯ ͱ ఆ Ί Β Εͯ ͍ Δ A t t r i b u t e ʹ ͠ ͔ ͜ Ε Λ ΍ Β ͳ ͍ ͨ Ί ɺ ޙ ͷ ੜ ੒ ί ʔ υ Ͱ ͜ Ε ͕ ແ ࢹ ͞ Ε · ͢
  32. H a m l A t t r i b

    u t e ࢓ ༷ 7 • ஋ʹtrue͕౉ͬͯ͘Δͱಛघͳग़ྗʹͳΓɺ͔ͭΦϓ γϣϯʹΑͬͯग़ྗ͕มΘΔ H a m l i t ͸ ϒʔ Ϧ Ξ ϯ ͱ ఆ Ί Β Εͯ ͍ Δ A t t r i b u t e ʹ ͠ ͔ ͜ Ε Λ ΍ Β ͳ ͍ ͨ Ί ɺ ޙ ͷ ੜ ੒ ί ʔ υ Ͱ ͜ Ε ͕ ແ ࢹ ͞ Ε · ͢
  33. H a m l A t t r i b

    u t e ࢓ ༷ 8 • Attribute͸ΞϧϑΝϕοτॱʹιʔτ͞ΕΔ
  34. H a m l A t t r i b

    u t e ࢓ ༷ 9 • ஋͕Hashͷ৔߹Attribute໊͕มΘΔ F a m l , H a m l i t ͸ d a t a a t t r i b u t e ʹ ͠ ͔ ͜ Ε Λ ద ༻ ͠ ͳ ͍ ͷ Ͱɺ ޙ ͷ ੜ ੒ ί ʔ υ Ͱ ͜ Ε ͕ d a t a Ҏ ֎ ͷ A t t r i b u t e Ͱ ແ ࢹ ͞ Ε · ͢
  35. H a m l A t t r i b

    u t e ࢓ ༷ 1 0 • ͜Ε·Ͱग़͖ͯͨશͯͷϧʔϧ͸ಉ࣌ʹ࢖༻Ͱ͖ɺෳ ਺ͷ஋͕౉͞ΕΔͱ஋͸Ϛʔδ͞ΕΔ͕ɺid, class, ͦ ΕҎ֎ͰAttribute͝ͱʹϚʔδنଇ͕ҧ͏
  36. ͜ ͷ Θ ͚ ͷ Θ ͔ Β Μ ࢓

    ༷ ͔ Β ੜ ੒ ͞ Ε Δ ί ʔ υ ͷ ༷ ࢠ
  37. ͜ ͷ H a m l ς ϯ ϓ Ϩ

    ʔ τ Λ Ϩϯ μ Ϧ ϯ ά ͢ Δ ͨ Ί ͷ ੜ ੒ ί ʔ υ ʹ ͭ ͍ͯ ߟ ͑ͯ Έ · ͠ ΐ ͏ ͜ ͷ ෦ ෼ ͸ ί ϯύΠϧ ࣌ ʹ ੜ ੒ Ͱ ͖ ͦ ͏ ɺ ͘ Β ͍Ͱ ͍ ͍Ͱ ͢ b ͕ ਅ ِ ஋ ͡ Ό ͳ ͍ έ ʔε Ͱ ͸ “ b a r = ‘ “ Λ Ұ ؾ ʹ ࿈ ݁ Ͱ ͖ ͦ ͏ ɺ ͱ ͔
  38. ͜ ͷ H a m l ς ϯ ϓ Ϩ

    ʔ τ Λ Ϩϯ μ Ϧ ϯ ά ͢ Δ ͨ Ί ͷ ੜ ੒ ί ʔ υ ʹ ͭ ͍ͯ ߟ ͑ͯ Έ · ͠ ΐ ͏ b , c , d ͸ ม ਺ ͳ ͷ Ͱ ࣄ લ ͷ Ϩϯ μ Ϧ ϯ ά ͸ ແ ཧ . c l a s s ͸ ࣄ લ ʹ Ϩϯ μ Ϧ ϯ ά Ͱ ͖ ͦ ͏ ͩ ͕ɺ c ͱ ཁ Ϛʔ δ ม ਺ ͕ H a s h ͩ ͱ A t t r i b u t e ໊ ͸ ม Θ Δ ม ਺ ͕ ਅ ِ ஋ ͩ ͱ A t t r i b u t e ໊ ΍ ஋ ͕ ফ ͑Δ ஫ ҙ :
  39. H a m l 4 ͷ ੜ ੒ ί ʔ

    υ Ϩϯ μ Ϧ ϯ ά ࣌ ʹ ΍ Γ ͨ ͍ ์ ୊ _ h a m l o u t . a t t r i b u t e s ͕ ஗ ͘ ɺ ͔ ͭ ৗ ʹ ݺ ͹ Ε Δ ͷ Ͱ Ξ ΢ τ S t r i n g i n t e r p o l a t i o n Ͱ ݁ ߹ + ό οϑ Ν ʹ ࠶ ౓ ݁ ߹ = ແ ବ
  40. F a m l ͷ ੜ ੒ ί ʔ υ

    d i v λ ά ͷ ό οϑ Ν ΁ ͷ ࿈ ݁ ෦ ෼ ʹ ແ ବ ͕ ͳ ͘ ͳ ͬͯ ͍ Δ d a t a a t t r i b u t e ͕ དྷ Δ ͱ ί ϯύΠϧ ࣌ ͷ ࠷ ద Խ Λ ์ غ ͢ Δ ͷ Ͱ F a m l ʹ ͸ ౎ ߹ ͕ ѱ ͍ έ ʔε ͩ ͕ɺ C + + ֦ ு Ͱ ಈ ͘ͷ Ͱ H a m l Α Γ ଎ ͍
  41. H a m l i t ͷ ੜ ੒ ί

    ʔ υ b a r ͱ c l a s s ʹ ର ͯ͠ ਅ ِ ஋ ΍ H a s h ͷ ͨ Ί ͷ ػ ೳ Λ ఏ ڙ ͯ͠ ͍ ͳ ͍ ( େ ෼ ζ ϧ ͍ ࢓ ༷ ) ͷ Ͱ ൑ ఆ ͳ ͠Ͱ ࣄ લ ʹ ࿈ ݁ Ͱ ͖ ɺ ߴ ଎ c l a s s , d a t a ͷ Ϛʔ δ ͷ ͨ Ί ʹ ઐ ༻ ͷ C ֦ ு ϝ ι ο υ ͕ ༻ ҙ ͞ Εͯ ͓ Γ ɺ ͦ Ε Λ ௚ ઀ ݺ ͼ ग़ ͢ͷ Ͱ ଎ ͍ ͨ ͩ ɺ ” d a t a = ‘ “ ͱ ͔ ͷ ෦ ෼ ͸ b u i l d _ d a t a ೚ ͤ ͩ ͕ … ?
  42. H a m l 5 ͷ ੜ ੒ ί ʔ

    υ ඞ ཁ ͳ ஋ Λ ޙ ํ ޓ ׵ ੑ ͷ ͋ Δ ॱ ং Ͱ ४ උ ͯ͠ ͓ ͖ ɺ c l a s s ઐ ༻ ͷ ํ ๏ Ͱ ஋ Λ Ϛʔ δ H a m l i t ͩ ͱ C ֦ ு Ͱ ྗ ٕ Ͱ ΍ ͬͯ ͍ Δ ͱ ͜ Ζ Λ ஸ ೡ ʹ ί ϯύ Πϧ ͯ͠ ͓ Γ ɺ ߴ ଎ i d , c l a s s ઐ ༻ ෼ ذ
  43. H a m l 5 ͷ ί ʔ υ ͸

    ͜ ͜ ͕ ε ΰ ͍ • ஗͘͢Δඞཁ͕͋Δͱ͜Ζ͚͕ͩ஗͍ • merge_valuesͱ͍͏ಛघͳॲཧ͸ɺ஋͕ෳ਺͔ͭid΍classͷέʔεͷΈ࢖ΘΕΔ • _hamlout.attributesͱ͍͏஗͍ϝιου͕ɺ͘͝ݶΒΕͨ৚݅Ͱ͔͠ݺ͹Εͳ͍ • ಛʹɺdataଐੑͷͨΊͷੜ੒ίʔυ͕Faml΍HamlitΑΓݡ͍ • (όοϑΝͷࢀরҎ֎Ͱ)ϝιουݺͼग़͠ͷ਺͕ཧ࿦্࠷খɺݺ͹ͳ͍ύε΋͋Δ • whenͷ෼ذ͸ςʔϒϧҾ͖Ͱ͋Γɺ૿΍ͯ͠΋஗͘ͳΒͳ͍ • case HashΛ࡟Δ౒ྗΛ͍ͯ͠ΔHamlit΍Famlʹൺ΂஗͘ͳ͍ͱ͍͏͜ͱ
  44. g o t o ઌ ͷ Ξ υ Ϩε Λ

    s t ͷ l o o k u p Ͱ औ ಘ w h e n ͷ ஋ ͕ ଈ ஋ ͔ F l o a t , S y m b o l , B i g n u m , S t r i n g ͔ ͭ ɺ ͦ Ε Β ͷ # = = = ͕ ࠶ ఆ ٛ ͞ Εͯ ͍ ͳ ͍ ৔ ߹
  45. H a m l 5 ͷ ί ʔ υ ͸

    ͜ ͜ ͕ ε ΰ ͍ • RipperͰRubyͷࣜΛύʔε͠ɺ੩తͳ஋͔Ͳ͏͔൑ఆͯ͠ίϯύΠϧ ࣌ʹϨϯμϦϯάͰ͖Δ • ίϯύΠϧ࣌ʹࣄલʹιʔτ͢ΔͷΛఘΊͨ͘ͳΔΑ͏ͳέʔεΛਅ ໘໨ʹղܾ͍ͯ͠Δ • hash = { bar: 1 } Ͱ %div{ foo: hash } ͳ࣌ɺίϯύΠϧ࣌ʹΘ͔ Δ”foo”͡Όͳͯ͘ɺϨϯμϦϯά࣌ʹ֬ఆ͢Δ”foo-bar”Ͱιʔτ ͠ͳ͍ͱ͍͚ͳ͍ • Hamlit΍Faml͸dataଐੑ͚ͩʹ”data-foo”Λద༻͢Δ͜ͱͰͦΕΛ ճආ͍ͯ͠ΔͨΊɺdataଐੑ͕དྷͯ͠·ͬͨ࣌ʹ஗͍
  46. H a m l 5 ͷ a t t r

    i b u t e ι ʔ τ ϩ δ ο Ϋ
  47. H a m l 5 ͷ a t t r

    i b u t e ι ʔ τ ϩ δ ο Ϋ a b , b - b c “ - ” Α Γ લ ͷ จ ࣈ ྻ ͕ ಉ ͡ ಉ ࢜ Λ άϧ ʔ ϐ ϯ ά
  48. H a m l 5 ͷ a t t r

    i b u t e ι ʔ τ ϩ δ ο Ϋ a b , b - b c “ - ” Α Γ લ ͷ จ ࣈ ྻ ͕ ಉ ͡ ಉ ࢜ Λ άϧ ʔ ϐ ϯ ά “ - ” Α Γ લ ͷ จ ࣈ ྻ Ͱ ι ʔ τ ɺ άϧ ʔϓ ͝ ͱ ʹ ࠷ ద Խ ໊ લ ͕ ಉ ͡ ʹ ͳ Γ ͏ Δ ౕ ͕ ಉ ͡ ϝ ι ο υ ʹ ౉ ͬͯ ͍ Δ
  49. H a m l 5 ͷ a t t r

    i b u t e ι ʔ τ ϩ δ ο Ϋ a b , b - b c “ - ” Α Γ લ ͷ จ ࣈ ྻ ͕ ಉ ͡ ಉ ࢜ Λ άϧ ʔ ϐ ϯ ά “ - ” Α Γ લ ͷ จ ࣈ ྻ Ͱ ι ʔ τ ɺ άϧ ʔϓ ͝ ͱ ʹ ࠷ ద Խ ͦ Ε Ҏ ֎ ͷ ෦ ෼ ʹ ׬ ᘳ ͳ ࠷ ద Խ ͕ ޮ ͍ͯ ͍ Δ ( ੩ త ͳ ࣜ ͷ ࣄ લ Ϩϯ μ Ϧ ϯ ά )
  50. H a m l 5 ͷ a t t r

    i b u t e ι ʔ τ ϩ δ ο Ϋ • ϝϞ: ͜ͷϩδοΫ͕ίʔφʔέʔεͰڍಈ͕มΘΓͦ͏ͳͷ͸࣮૷͔ͨ࣌͠Βೝࣝ͠ ͍ͯΔ • ຊ౰͸ ”b,=” ͸ “b-b=” ΑΓखલʹདྷͳ͍ͱ͍͚ͳ͍͕ͦ͏ͳΒͳ͍ • “b,”ͱ”b”Ͱιʔτ͞ΕΔͱ”b”͕ઌʹདྷΔ͕ɺ”b,”ͱ”b-”Ͱ͸”b,”͕ઌʹདྷΔ • ͔ͱ͍ͬͯ”-”͕ͭ͘ͱ͸ݶΒͳ͍ͷͰ”b”Λ”b-”ʹͯ͠΋μϝ • “-”ΑΓલͳͷ͸ه߸͚ͩͳͷͰɺ࣮ࡍ͸࢖Θͳ͍͠Ͳ͏Ͱ΋͍͍ • ͜ͷࢿྉॻ͍ͯͨΒɺ͓ޓ͍ʹઌ಄͔Βͷจࣈྻ͕1จࣈͰ΋ڞ௨͢ΔάϧʔϓΛ࡞ͬ ͯ͋͛Ε͹ΧόʔͰ͖Δ (“b,”ͱ”b-b”͕དྷͨΒ”b”ͷάϧʔϓʹ͢Δ) ͜ͱʹؾ෇͍ͨ ͷͰͦͷ͏࣮ͪ૷͠·͢
  51. T O K Y U ʹ ޲ ͚ ͯ ߋ

    ʹ H A M L Λ ଎ ͘ ͯ͠ ͖ ͨ ࿩ T H E A R C H I T E C T U R E O F H A M L 5
  52. ί ϯύΠϧ ର ৅ ͷ H a m l ͷ

    ί ʔ υ ί ϯύΠϧ ޙ ͷ R u b y ͷ ί ʔ υ ( b e f o re )
  53. ί ϯύΠϧ ର ৅ ͷ H a m l ͷ

    ί ʔ υ ί ϯύΠϧ ޙ ͷ R u b y ͷ ί ʔ υ ( b e f o re ) ί ϯύΠϧ ޙ ͷ R u b y ͷ ί ʔ υ ( a f t e r )
  54. ί ϯύΠϧ ର ৅ ͷ H a m l ͷ

    ί ʔ υ ί ϯύΠϧ ޙ ͷ R u b y ͷ ί ʔ υ ( b e f o re ) ί ϯύΠϧ ޙ ͷ R u b y ͷ ί ʔ υ ( a f t e r ) t e x t a re a , p re , c o d e Ҏ ֎ ͷ R u b y ͷ ε Ϋ Ϧ ϓ τ ຒ Ί ࠐ Έ ɺ ͭ · Γ ΄ ͱ Μ Ͳͷ έ ʔε ͕ ߴ ଎ Խ ର ৅ ͜ ͷ ༨ ܭ ͳ ॲ ཧ ͕ ফ ͑Δ
  55. f i x _ t e x t a re

    a s ! ͱ ͸ • textareaλάͷ಺ଆʹվߦ͕͋ͬͯ΋ද্ࣔ͸վߦ͞Εͳ͍ϒϥ΢β ޲͚ʹɺHaml͸textareaλάͷ಺ଆͷ”\n”Λ”
”ʹΤεέʔϓ ͢Δ • Haml಺Ͱ͸preserveͱ͍͏໊લͰ࣮૷͞Ε͓ͯΓɺtextarea౳ͷλ άͷ಺ଆͰͷΈ͜Ε͕ݺ͹ΕΔ Rails 3.2.3ͰɺRailsͷtext_areaϔϧύʔͷ։࢝λάͷ௚ޙʹվߦΛ͍ ΕΔͱ͍͏໎࿭ͳมߋ͕ೖͬͨ ͦͷ࠷ॳͷվߦ΋Τεέʔϓ͞ΕΔͱظ଴͢ΔڍಈʹͳΒͳ͍ϒ ϥ΢βͷͨΊʹɺ࠷ॳͷ”
”Λ”\n”ʹ໭͍ͯ͠Δ
  56. f i x _ t e x t a re

    a s ! ͱ ͸ • textareaλάͷ಺ଆʹվߦ͕͋ͬͯ΋ද্ࣔ͸վߦ͞Εͳ͍ϒϥ΢β ޲͚ʹɺHaml͸textareaλάͷ಺ଆͷ”\n”Λ”
”ʹΤεέʔϓ ͢Δ • Haml಺Ͱ͸preserveͱ͍͏໊લͰ࣮૷͞Ε͓ͯΓɺtextarea౳ͷλ άͷ಺ଆͰͷΈ͜Ε͕ݺ͹ΕΔ • Rails 3.2.3ͰɺRailsͷtext_areaϔϧύʔͷ։࢝λάͷ௚ޙʹվߦΛ͍ ΕΔͱ͍͏໎࿭ͳมߋ͕ೖͬͨ • ͦͷ࠷ॳͷվߦ΋Τεέʔϓ͞ΕΔͱظ଴͢ΔڍಈʹͳΒͳ͍ϒ ϥ΢βͷͨΊʹɺ࠷ॳͷ”
”Λ”\n”ʹ໭͍ͯ͠Δ
  57. f i x _ t e x t a re

    a s ! ͱ ͸ • textareaλάͷ಺ଆʹվߦ͕͋ͬͯ΋ද্ࣔ͸վߦ͞Εͳ͍ϒϥ΢β ޲͚ʹɺHaml͸textareaλάͷ಺ଆͷ”\n”Λ”
”ʹΤεέʔ ϓ͢Δ • Haml಺Ͱ͸preserveͱ͍͏໊લͰ࣮૷͞Ε͓ͯΓɺtextarea౳ͷ λάͷ಺ଆͰͷΈ͜Ε͕ݺ͹ΕΔ • Rails 3.2.3ͰɺRailsͷtext_areaϔϧύʔͷ։࢝λάͷ௚ޙʹվߦΛ͍ ΕΔͱ͍͏໎࿭ͳมߋ͕ೖͬͨ • ͦͷ࠷ॳͷվߦ΋Τεέʔϓ͞ΕΔͱظ଴͢ΔڍಈʹͳΒͳ͍ϒ ϥ΢βͷͨΊʹɺ࠷ॳͷ”
”Λ”\n”ʹ໭͍ͯ͠Δ
  58. f i x _ t e x t a re

    a s ! ͱ ͸ • textareaλάͷ಺ଆʹվߦ͕͋ͬͯ΋ද্ࣔ͸վߦ͞Εͳ͍ϒϥ΢β ޲͚ʹɺHaml͸textareaλάͷ಺ଆͷ”\n”Λ”
”ʹΤεέʔ ϓ͢Δ • Haml಺Ͱ͸preserveͱ͍͏໊લͰ࣮૷͞Ε͓ͯΓɺtextarea౳ͷ λάͷ಺ଆͰͷΈ͜Ε͕ݺ͹ΕΔ • Rails 3.2.3ͰɺRailsͷtext_areaϔϧύʔͷ։࢝λάͷ௚ޙʹվߦΛ͍ ΕΔͱ͍͏໎࿭ͳมߋ͕ೖͬͨ • ͦͷ࠷ॳͷվߦ΋Τεέʔϓ͞ΕΔͱظ଴͢ΔڍಈʹͳΒͳ͍ϒ ϥ΢βͷͨΊʹɺ࠷ॳͷ”
”Λ”\n”ʹ໭͍ͯ͠Δ = > t e x t a re a ౳ ͷ ಺ ଆ Ͱ ͩ ͚ f i x _ t e x t a re a s ! ͢ Ε ͹ ྑ ͍ ͷ Ͱ ͸ ! ! ( ͜ Ε Λ ΍ ͬ ͨ )
  59. ଎ ͘ ͳ ͬ ͨ : 3 . 3 2

    x → 3 . 7 7 x
  60. H A M L 6 Ͱ ΍ Γ ͨ ͍

    ͜ ͱ T H E A R C H I T E C T U R E O F H A M L 5
  61. H T T P S t re a m i

    n g f o r R a i l s • haml/haml#436 • Railsͷ render stream: true ͬͯ஌ͬͯ·͔͢ • ๻͸࢖ͬͨ͜ͱͳ͍ • partial͕ϨϯμϦϯά͞ΕΔ౓ʹνϟϯΫͱͯ͠ΫϥΠΞϯτʹ ૹΒΕΔ • ίʔυੜ੒ث͕෼཭͞ΕͨͷͰ៉ྷʹ࣮૷Ͱ͖ΔΑ͏ʹͳͬͨ • ΄ͲΑ͍࣮૷೉қ౓͔ͭ໘നΊͷػೳͳͷͰ୭͔࣮૷͍ͯͩ͘͠͞
  62. L a z y H a m l B u

    ff e r ͜ Ε ͸ ݱ ঢ় ͷ ί ʔ υ
  63. L a z y H a m l B u

    ff e r H a m l : : B u ff e r. n e w ͕ ஗ ͍ ͷ Ͱ Ͳ ͏ ʹ ͔ ͯ͠ _ h a m l o u t ͷ ੜ ੒ Λ ΍ Ί ͨ ͍
  64. L a z y H a m l B u

    ff e r _ h a m l o u t . b u ff e r ͸ ผ ͷ ϩ ʔΧ ϧ ม ਺ ʹ ม ͑ Β Ε Δ
  65. L a z y H a m l B u

    ff e r ͦ ͏͢ Δ ͱ _ h a m l o u t ͷ ༻ ్ ͕ɺ ͜ ͜ Ͱ ͸ ஋ ͕ H a s h , A r r a y ౳ ͷ ৔ ߹ ͳ Ͳ ɺ ( f i x _ t e x t a re a s ! Λ ফ ͠ ͨ ͷ Ͱ ) ͋ · Γ ࢖ Θ Ε ͳ ͍ έ ʔε ʹ ߜ Β Ε Δ
  66. L a z y H a m l B u

    ff e r ͳ Β ɺ H a m l : : B u ff e r ͸ ࠷ ॳ ʹ ࡞ Βͣɺ ಺ ෦ ͷ ό οϑ Ν ʔ Λ Π ϯε λ ϯε ม ਺ @ _ e r b o u t ʹ ͍ Εͯ ͓ ͍ͯɺ
  67. L a z y H a m l B u

    ff e r _ h a m l o u t ͕ ݺ ͹ Ε ͨ ࣌ ʹ @ _ e r b o u t Λ H a m l : : B u ff e r. n e w Ͱ ϥ οϓ ͢ Ε ͹ ͍ ͍ ͷ Ͱ ͸ ! ? ͱ ͍ ͏ ໨ ࿦ Έ
  68. L a z y H a m l B u

    ff e r • ΊͪΌͪ͘Ό଎͘ͳΓɺΑ͘࢖ͬͯΔϕϯνϚʔΫͰݱߦ࢓༷ͷཧ࿦஋ ʹ౸ୡͰ͖Δ • Famlͱ΄΅ಉ଎ʹͳΔ͜ͱΛݕূࡁ • ۃΊ࣮ͯ૷೉қ౓͕ߴ͍ • HamlϚχΞͷਓ͚ͩͲ͏ͧ • εϥΠυͷதͰ͸͍Ζ͍Ζඞཁͳ͜ͱΛলུͯ͠ΔͷͰɺͱΓ͋͑ͣ ͕Μ͹ͬͯͦΕΒʹḷΓ͍͍ͭͯͩ͘͞ • Hamlߴ଎ԽͷϥεϘε(?)