Class: PinchHitter::Message::MessageStore
- Inherits:
-
Object
- Object
- PinchHitter::Message::MessageStore
- Includes:
- ContentType, Json, Xml
- Defined in:
- lib/pinch_hitter/message/message_store.rb
Instance Attribute Summary collapse
-
#message_directory ⇒ Object
Returns the value of attribute message_directory.
Instance Method Summary collapse
- #find_filename(file) ⇒ Object
-
#initialize(message_directory) ⇒ MessageStore
constructor
A new instance of MessageStore.
- #load(file, overrides = {}) ⇒ Object
Methods included from ContentType
Methods included from Json
Methods included from Xml
Constructor Details
#initialize(message_directory) ⇒ MessageStore
Returns a new instance of MessageStore.
13 14 15 |
# File 'lib/pinch_hitter/message/message_store.rb', line 13 def initialize() = end |
Instance Attribute Details
#message_directory ⇒ Object
Returns the value of attribute message_directory.
11 12 13 |
# File 'lib/pinch_hitter/message/message_store.rb', line 11 def end |
Instance Method Details
#find_filename(file) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/pinch_hitter/message/message_store.rb', line 26 def find_filename(file) filename = Dir["#{message_directory}/#{file}*"].first unless filename fail "Could not find message for '#{file}' in '#{File.expand_path(File.dirname(message_directory))}'" end filename end |
#load(file, overrides = {}) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/pinch_hitter/message/message_store.rb', line 17 def load(file, overrides={}) filename = find_filename file if filename =~ /xml$/ filename, overrides else filename, overrides end end |