class Cookbooks::ArchiveType

Constants

DEFAULT_ARCHIVE_TYPE
#

DEFAULT_ARCHIVE_TYPE

#

Public Class Methods

archive_type?(i) click to toggle source
#

::archive_type? 'foobar-1.0.tar.xz'

#
# File lib/cookbooks/misc/archive_type.rb, line 27
def self.archive_type?(i)
  self.new(i).archive_type?
end
new(i) click to toggle source
#

initialize

#
# File lib/cookbooks/misc/archive_type.rb, line 34
def initialize(i)
  set_archive_type(i)
end

Public Instance Methods

archive_type?() click to toggle source
#

archive_type

Feedback the archive type.

#
# File lib/cookbooks/misc/archive_type.rb, line 58
def archive_type?
  @archive_type
end
Also aliased as: to_s
set_archive_type(i = nil) click to toggle source
#

#set_archive_type

#
# File lib/cookbooks/misc/archive_type.rb, line 41
def set_archive_type(i = nil)
  i = DEFAULT_ARCHIVE_TYPE if i.nil?
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  if i.include?    '.tar.bz2'
    i = '.tar.bz2'
  elsif i.include? '.tar.gz'
    i = '.tar.gz'
  end
  @archive_type = i
end
to_s()
Alias for: archive_type?