Class: R10K::Module::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/r10k/module/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata_path) ⇒ Metadata



20
21
22
23
24
# File 'lib/r10k/module/metadata.rb', line 20

def initialize()
   = 

  @version = R10K::SemVer::MIN
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



13
14
15
# File 'lib/r10k/module/metadata.rb', line 13

def author
  @author
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/r10k/module/metadata.rb', line 9

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



17
18
19
# File 'lib/r10k/module/metadata.rb', line 17

def version
  @version
end

Instance Method Details

#exist?Boolean

Does the metadata file itself exist?



27
28
29
# File 'lib/r10k/module/metadata.rb', line 27

def exist?
  .file? and .readable?
end

#readObject

Attempt to read the metadata file



32
33
34
35
36
37
38
39
# File 'lib/r10k/module/metadata.rb', line 32

def read
  if self.exist?
    hash = JSON.parse(.read)
    attributes_from_hash(hash)
  end
rescue JSON::ParserError
  false
end