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].freeze
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)
35 36 37 |
# File 'lib/libosctl/sys_conf.rb', line 35 def get_page_size Etc.sysconf(Etc::SC_PAGESIZE) end |
#get_tics_per_second ⇒ Object (protected)
39 40 41 |
# File 'lib/libosctl/sys_conf.rb', line 39 def get_tics_per_second Etc.sysconf(Etc::SC_CLK_TCK) end |