Class: SleepingKingStudios::Tools::Messages::Strategies::FileStrategy
- Inherits:
-
HashStrategy
- Object
- SleepingKingStudios::Tools::Messages::Strategy
- HashStrategy
- SleepingKingStudios::Tools::Messages::Strategies::FileStrategy
- Defined in:
- lib/sleeping_king_studios/tools/messages/strategies/file_strategy.rb
Overview
Messaging strategy that loads message templates from the given file.
Defined Under Namespace
Classes: FileError
Instance Attribute Summary collapse
-
#file_name ⇒ String
readonly
The full path to the file with the templates data.
Attributes inherited from HashStrategy
Instance Method Summary collapse
-
#initialize(file_name) ⇒ FileStrategy
constructor
A new instance of FileStrategy.
Methods inherited from SleepingKingStudios::Tools::Messages::Strategy
Constructor Details
#initialize(file_name) ⇒ FileStrategy
Returns a new instance of FileStrategy.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sleeping_king_studios/tools/messages/strategies/file_strategy.rb', line 14 def initialize(file_name) validate_file_name(file_name) @file_name = file_name raw_data = read_file(file_name) templates = parse_templates(raw_data) super(templates) end |
Instance Attribute Details
#file_name ⇒ String (readonly)
Returns the full path to the file with the templates data.
25 26 27 |
# File 'lib/sleeping_king_studios/tools/messages/strategies/file_strategy.rb', line 25 def file_name @file_name end |