Class: Jekyll::Archimate::JsonFile
- Inherits:
-
Object
- Object
- Jekyll::Archimate::JsonFile
- Defined in:
- lib/jekyll/archimate/archimate_hook.rb
Overview
Writes any object that can be hashified (with to_h) to a JSON file
Instance Method Summary collapse
-
#initialize(filename) ⇒ JsonFile
constructor
A new instance of JsonFile.
- #write(obj) ⇒ Object
Constructor Details
#initialize(filename) ⇒ JsonFile
Returns a new instance of JsonFile.
149 150 151 |
# File 'lib/jekyll/archimate/archimate_hook.rb', line 149 def initialize(filename) @filename = filename end |
Instance Method Details
#write(obj) ⇒ Object
153 154 155 156 157 |
# File 'lib/jekyll/archimate/archimate_hook.rb', line 153 def write(obj) File.open(@filename, "wb") do |file| file.write(JSON.generate(obj.to_h)) end end |