Class: Cfruby::OS::OpenBSDOS
- Defined in:
- lib/libcfruby/osmodules/openbsd.rb
Instance Method Summary collapse
-
#[](key) ⇒ Object
an alternative to calling lookup.
-
#get_package_manager ⇒ Object
returns an object implementing the PackageManager interface as appropriate for the default package management system for a given OS.
-
#get_user_manager ⇒ Object
Returns a UserManager object specific to FreeBSD.
-
#initialize ⇒ OpenBSDOS
constructor
A new instance of OpenBSDOS.
-
#lookup(key) ⇒ Object
returns the value of the given key for this OS.
Methods inherited from OS
#get_process_manager, #get_scheduler, #method_missing, #to_s
Constructor Details
#initialize ⇒ OpenBSDOS
Returns a new instance of OpenBSDOS.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/libcfruby/osmodules/openbsd.rb', line 10 def initialize() @keys = Hash.new() @keys['name'] = 'OpenBSD' @keys['openbsd'] = true @keys['OpenBSD'] = true @keys['OPENBSD'] = true @keys['version'] = `uname -r`.strip() @keys['hostname'] = `/bin/hostname`.strip() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cfruby::OS::OS
Instance Method Details
#[](key) ⇒ Object
an alternative to calling lookup
50 51 52 |
# File 'lib/libcfruby/osmodules/openbsd.rb', line 50 def [](key) return(lookup(key)) end |
#get_package_manager ⇒ Object
returns an object implementing the PackageManager interface as appropriate for the default package management system for a given OS
25 26 27 |
# File 'lib/libcfruby/osmodules/openbsd.rb', line 25 def get_package_manager() return(Packages::OpenBSDPackageManager.new()) end |
#get_user_manager ⇒ Object
Returns a UserManager object specific to FreeBSD
31 32 33 |
# File 'lib/libcfruby/osmodules/openbsd.rb', line 31 def get_user_manager() return(Users::OpenBSDUserManager.new()) end |
#lookup(key) ⇒ Object
returns the value of the given key for this OS. At a minimum an OS should provide the following:
- name
-
returns the name of the OS
- version
-
the version of the OS
- osname
-
e.g. freebsd, linux, windows, etc - these should return true and be case insensitive to allow
lookups of the form lookup(‘Windows’) In addition to the above name and version should be implemented as getter methods for convenience
44 45 46 |
# File 'lib/libcfruby/osmodules/openbsd.rb', line 44 def lookup(key) return(@keys[key]) end |