Class: OsCtl::Lib::SysConf
- Inherits:
-
Object
- Object
- OsCtl::Lib::SysConf
- Includes:
- Singleton
- Defined in:
- lib/libosctl/sys_conf.rb
Constant Summary collapse
- VALUES =
%i(page_size tics_per_second)
Instance Method Summary collapse
- #get(name) ⇒ Object
- #get_page_size ⇒ Object protected
- #get_tics_per_second ⇒ Object protected
-
#initialize ⇒ SysConf
constructor
A new instance of SysConf.
Constructor Details
#initialize ⇒ SysConf
Returns a new instance of SysConf.
16 17 18 |
# File 'lib/libosctl/sys_conf.rb', line 16 def initialize @values = {} end |
Instance Method Details
#get(name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/libosctl/sys_conf.rb', line 21 def get(name) unless VALUES.include?(name) raise ArgumentError, "#{name.inspect} is not known" end @values[name] ||= send(:"get_#{name}") end |
#get_page_size ⇒ Object (protected)
34 35 36 |
# File 'lib/libosctl/sys_conf.rb', line 34 def get_page_size Etc.sysconf(Etc::SC_PAGESIZE) end |
#get_tics_per_second ⇒ Object (protected)
38 39 40 |
# File 'lib/libosctl/sys_conf.rb', line 38 def get_tics_per_second Etc.sysconf(Etc::SC_CLK_TCK) end |