Class: SleepingKingStudios::Tools::Messages::Strategies::HashStrategy
- Inherits:
-
SleepingKingStudios::Tools::Messages::Strategy
- Object
- SleepingKingStudios::Tools::Messages::Strategy
- SleepingKingStudios::Tools::Messages::Strategies::HashStrategy
- Defined in:
- lib/sleeping_king_studios/tools/messages/strategies/hash_strategy.rb
Overview
Messaging strategy that refers to an internal Hash of templates.
Direct Known Subclasses
Defined Under Namespace
Classes: ParseError
Instance Attribute Summary collapse
-
#templates ⇒ Hash
readonly
The templates used to generate messages.
Instance Method Summary collapse
-
#initialize(templates) ⇒ HashStrategy
constructor
A new instance of HashStrategy.
Methods inherited from SleepingKingStudios::Tools::Messages::Strategy
Constructor Details
#initialize(templates) ⇒ HashStrategy
Returns a new instance of HashStrategy.
12 13 14 15 16 17 18 19 20 |
# File 'lib/sleeping_king_studios/tools/messages/strategies/hash_strategy.rb', line 12 def initialize(templates) super() unless templates.is_a?(Hash) raise ArgumentError, 'templates is not an instance of Hash' end @templates = flatten_templates(templates).freeze end |
Instance Attribute Details
#templates ⇒ Hash (readonly)
Returns the templates used to generate messages.
23 24 25 |
# File 'lib/sleeping_king_studios/tools/messages/strategies/hash_strategy.rb', line 23 def templates @templates end |