Class: Jah::Pkg
- Inherits:
-
Object
show all
- Includes:
- Comparable
- Defined in:
- lib/jah/act_pkg/pkg.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ Pkg
Returns a new instance of Pkg.
7
8
9
|
# File 'lib/jah/act_pkg/pkg.rb', line 7
def initialize(*args)
@status, @name, @version, @desc = args
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*meth) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/jah/act_pkg/pkg.rb', line 44
def method_missing(*meth)
unless (val = info[meth[0]]).nil?
val
else
raise NoMethodError
end
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/jah/act_pkg/pkg.rb', line 5
def name
@name
end
|
#size ⇒ Object
Returns the value of attribute size.
5
6
7
|
# File 'lib/jah/act_pkg/pkg.rb', line 5
def size
@size
end
|
#status ⇒ Object
Returns the value of attribute status.
5
6
7
|
# File 'lib/jah/act_pkg/pkg.rb', line 5
def status
@status
end
|
#version ⇒ Object
Returns the value of attribute version.
5
6
7
|
# File 'lib/jah/act_pkg/pkg.rb', line 5
def version
@version
end
|
Instance Method Details
#<=>(other) ⇒ Object
34
35
36
37
|
# File 'lib/jah/act_pkg/pkg.rb', line 34
def <=>(other)
raise "Not same pkg.." unless name == other.name
version <=> other.version
end
|
#==(other) ⇒ Object
30
31
32
|
# File 'lib/jah/act_pkg/pkg.rb', line 30
def ==(other)
(name == other.name) && (version == other.version)
end
|
#desc ⇒ Object
11
12
13
|
# File 'lib/jah/act_pkg/pkg.rb', line 11
def desc
@desc ||= info[:desc]
end
|
#info ⇒ Object
15
16
17
|
# File 'lib/jah/act_pkg/pkg.rb', line 15
def info
@info ||= ActPkg.info(self)
end
|
#install ⇒ Object
23
24
25
|
# File 'lib/jah/act_pkg/pkg.rb', line 23
def install
ActPkg.install(self)
end
|
#installed? ⇒ Boolean
19
20
21
|
# File 'lib/jah/act_pkg/pkg.rb', line 19
def installed?
@status == :installed
end
|
#uninstall ⇒ Object
27
28
|
# File 'lib/jah/act_pkg/pkg.rb', line 27
def uninstall
end
|
#valid? ⇒ Boolean
39
40
41
|
# File 'lib/jah/act_pkg/pkg.rb', line 39
def valid?
!(@name.nil? or @version.nil?)
end
|