Class: Archive

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Archive

Returns a new instance of Archive.



24
25
26
27
28
# File 'lib/archive.rb', line 24

def initialize type
  type = type.to_s
  puts_fail "Unsupported type" unless %w[lzo gzip].include? type.downcase
  instance_eval %{@type = #{type.upcase}}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



30
31
32
# File 'lib/archive.rb', line 30

def method_missing name, *args
  StringIO.new @type.send(name, *args)
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



22
23
24
# File 'lib/archive.rb', line 22

def type
  @type
end