Class: Clicks::Serializer
- Inherits:
-
Object
- Object
- Clicks::Serializer
- Defined in:
- lib/clicks/serializer.rb
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ Serializer
constructor
A new instance of Serializer.
- #read_file ⇒ Object
- #write_file(clicks) ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Serializer
Returns a new instance of Serializer.
6 7 8 9 10 11 12 |
# File 'lib/clicks/serializer.rb', line 6 def initialize( = nil) @path = if .present? && [:path].present? [:path].to_s else "./lib/clicks.json" end end |
Instance Method Details
#read_file ⇒ Object
13 14 15 16 17 |
# File 'lib/clicks/serializer.rb', line 13 def read_file file = File.read(@path) parsed_file = JSON.parse(file) parsed_file end |
#write_file(clicks) ⇒ Object
18 19 20 |
# File 'lib/clicks/serializer.rb', line 18 def write_file(clicks) end |