Class: Clicks::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/clicks/serializer.rb

Instance Method Summary collapse

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(options = nil)
  @path = if options.present? && options[:path].present?
            options[:path].to_s
          else
            "./lib/clicks.json"
          end
end

Instance Method Details

#read_fileObject



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