This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hash | |
| def method_missing(name, *args) | |
| self[name] || self[name.to_s] || super | |
| end | |
| end | |
| hash = {a: "hoge"} | |
| p hash.a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package for_sample | |
| object Sample01 extends App { | |
| val a: Option[Int] = Some(1) | |
| val b: Option[Int] = None | |
| val result:Option[Int] = | |
| for { | |
| c <- a | |
| d <- b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" + super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" + super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" + super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" + super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" + super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parent | |
| def name | |
| "parent" | |
| end | |
| end | |
| module Hoge | |
| def name | |
| "hoge" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bar(normal, a: 1, b: 2, **others) | |
| puts normal | |
| puts a | |
| puts b | |
| puts others | |
| end | |
| bar("head", {a: 100, b: 1000, c: 10000}) |