Class: Arli::Lock::Formats::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/arli/lock/formats/json.rb

Direct Known Subclasses

Yaml

Instance Attribute Summary collapse

Attributes inherited from Base

#arlifile, #lock_file

Instance Method Summary collapse

Methods inherited from Base

#extension, #initialize

Methods included from Helpers::Inherited

included

Constructor Details

This class inherits a constructor from Arli::Lock::Formats::Base

Instance Attribute Details

#hashObject

Returns the value of attribute hash.



9
10
11
# File 'lib/arli/lock/formats/json.rb', line 9

def hash
  @hash
end

Instance Method Details



21
22
23
# File 'lib/arli/lock/formats/json.rb', line 21

def footer
  JSON.pretty_generate(hash)
end

#format(library) ⇒ Object



16
17
18
19
# File 'lib/arli/lock/formats/json.rb', line 16

def format(library)
  hash[library.canonical_dir] = library.to_hash
  nil
end

#headerObject



11
12
13
14
# File 'lib/arli/lock/formats/json.rb', line 11

def header
  self.hash = {}
  nil
end