This file contains 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
# 本パターンは構造を持ったインスタンスを組み上げていく | |
# Builderのインターフェイスを持ち具体的にインスタンスを組み上げる | |
# ConcreateBuilderがある | |
# DirectorはBuiderのインターフェイスだけを使って指示を出し、ConcreateBuilderにインスタンスを組み上げさせる | |
# 従って、色々なConcreateBuilderがあってもDirectorは影響を受けず指示できる | |
class Builder # インターフェイスを定めている | |
def makeTitle(title) end | |
def makeString(str) end | |
def makeItems(items) end |
This file contains 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
============================== | |
『Greeting』 | |
■朝から昼にかけて | |
・おはようございます。 | |
・こんにちは。 | |
■夜で |
This file contains 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
============================== | |
『Greeting』 | |
■朝から昼にかけて | |
・おはようございます。 | |
・こんにちは。 | |
■夜で |
This file contains 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
============================== | |
『Greeting』 | |
■朝から昼にかけて | |
・おはようございます。 | |
・こんにちは。 | |
■夜で |
This file contains 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
============================== | |
『Greeting』 | |
■朝から昼にかけて | |
・おはようございます。 | |
・こんにちは。 | |
■夜で |
This file contains 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
============================== | |
『Greeting』 | |
■朝から昼にかけて | |
・おはようございます。 | |
・こんにちは。 | |
■夜で |
This file contains 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
# -*- coding: utf-8 -*- | |
# ビルダーパターン | |
# | |
# Java言語で学ぶデザインパターンと同様の例題をRubyで記述した。 | |
# | |
# coded by Takehiro Kaga | |
# | |
# 本パターンは構造を持ったインスタンスを組み上げていく | |
# Builderのインターフェイスを持ち具体的にインスタンスを組み上げる | |
# ConcreateBuilderがある |
This file contains 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
# -*- coding: utf-8 -*- | |
# 本パターンは構造を持ったインスタンスを組み上げていく | |
# Builderのインターフェイスを持ち具体的にインスタンスを組み上げる | |
# ConcreateBuilderがある | |
# DirectorはBuiderのインターフェイスだけを使って指示を出し、ConcreateBuilderにインスタンスを組み上げさせる | |
# 従って、色々なConcreateBuilderがあってもDirectorは影響を受けず指示できる | |
class Builder # インターフェイスを定めている | |
def makeTitle(title) end | |
def makeString(str) end |
This file contains 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
Zombie.find(1) |
This file contains 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
zombie = Zombie.new | |
zombie.save |