Class: Cfruby::Packages::PackageInfo
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Cfruby::Packages::PackageInfo
- Defined in:
- lib/libcfruby/packages.rb
Overview
A holding object for information about a package. Currently implemented as a simple OpenStruct. Should provide accessor methods for as many of the following as possible (listed in order of importance):
- name
-
The name of the package without version numbers (apache)
- version
-
The version of the package (1.3.1r2)
- fullname
-
The full name of the package (Apache Web Server)
- description
-
A short description of the package (A full-featured and fast web server)
os-specific items (category, origin, etc)
Instance Method Summary collapse
Instance Method Details
#to_hash ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/libcfruby/packages.rb', line 53 def to_hash() keyregex = /^([^=]+)=$/ hash = Hash.new() self.methods.each() { |pkey| match = keyregex.match(pkey) if(match) hash[match[1]] = self.send(match[1].to_sym) end } return(hash) end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/libcfruby/packages.rb', line 49 def to_s() return("#{self.name}-#{self.version}") end |