Class: Dropdown::OutputStores::FileStore
- Inherits:
-
Object
- Object
- Dropdown::OutputStores::FileStore
- Defined in:
- lib/dropdown/output_stores/file_store.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(output_path) ⇒ FileStore
constructor
A new instance of FileStore.
- #save(contents, file_name) ⇒ Object
Constructor Details
#initialize(output_path) ⇒ FileStore
Returns a new instance of FileStore.
6 7 8 |
# File 'lib/dropdown/output_stores/file_store.rb', line 6 def initialize(output_path) @output_path = output_path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/dropdown/output_stores/file_store.rb', line 4 def path @path end |
Instance Method Details
#save(contents, file_name) ⇒ Object
10 11 12 13 14 |
# File 'lib/dropdown/output_stores/file_store.rb', line 10 def save(contents, file_name) create_directory @output_path @path = "#{@output_path}/#{file_name}" File.open(@path, 'w+') { |f| f.write contents } end |