Class: Revamp::Parser::PuppetTarball::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/revamp/parser/puppet-tarball.rb

Overview

An entry from tarball

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tarfile) ⇒ Entry

Returns a new instance of Entry.



63
64
65
66
67
68
# File 'lib/revamp/parser/puppet-tarball.rb', line 63

def initialize(tarfile)
  @tarfile = tarfile
  @name    = tarfile.full_name
  @content = nil
  @content = tarfile.read unless @tarfile.directory?
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



61
62
63
# File 'lib/revamp/parser/puppet-tarball.rb', line 61

def content
  @content
end

#nameObject

Returns the value of attribute name.



62
63
64
# File 'lib/revamp/parser/puppet-tarball.rb', line 62

def name
  @name
end

Instance Method Details

#file?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/revamp/parser/puppet-tarball.rb', line 74

def file?
  !content.nil?
end

#metadata?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/revamp/parser/puppet-tarball.rb', line 70

def metadata?
  !@tarfile.directory? && name.end_with?('metadata.json')
end