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
| abstract class Product { | |
| abstract use: () => void | |
| } | |
| abstract class Factory { | |
| create = (owner: string): Product => { | |
| const product = this.createProduct(owner) | |
| this.registerProduct(product) |
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
| abstract class AbstractDisplay { | |
| abstract open: () => void | |
| abstract print: () => void | |
| abstract close: () => void | |
| display = (): void => { | |
| this.open() | |
| for (let index = 0; index < 4; index++) { | |
| this.print() |
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
| interface IPrint { | |
| printWeak: () => void | |
| printStrong: () => void | |
| } | |
| class Banner { | |
| private text: string | |
| constructor(text: string) { | |
| this.text = text |
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
| interface IAggregate<T> { | |
| iterator: () => T | |
| } | |
| interface IIterator<T> { | |
| hasNext: () => boolean; | |
| next: () => T; | |
| } | |
| class Book { |
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
| authenticate | |
| 平文パスワードを渡すと、ハッシュ化されたパスワードと一致するかを確かめ、偽であればfalse,真であればオブジェクトを返す | |
| def authenticate(request, &login_procedure) | |
| if has_basic_credentials?(request) | |
| login_procedure.call(*user_name_and_password(request)) | |
| end | |
| end | |
| create:オブジェクトの作成と保存を同時に行い、オブジェクトを返す |