Class: OsCtl::Lib::CGroup::PathReader::Base
- Inherits:
-
Object
- Object
- OsCtl::Lib::CGroup::PathReader::Base
- Includes:
- Utils::Humanize
- Defined in:
- lib/libosctl/cgroup/path_reader.rb
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
protected
Returns the value of attribute cache.
Instance Method Summary collapse
- #cache_param(path, name) ⇒ Object protected
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #meminfo ⇒ Object protected
Methods included from Utils::Humanize
#break_interval, #format_long_duration, #format_percent, #format_short_duration, #humanize_data, #humanize_number, #humanize_percent, #humanize_time_ns, #humanize_time_us, #parse_data
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 7 def initialize @cache = {} end |
Instance Attribute Details
#cache ⇒ Object (readonly, protected)
Returns the value of attribute cache.
13 14 15 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 13 def cache @cache end |
Instance Method Details
#cache_param(path, name) ⇒ Object (protected)
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 19 def cache_param(path, name) path_cache = cache[path] if path_cache name_cache = path_cache[name] return name_cache if name_cache end cache[path] ||= {} cache[path][name] = yield(path, name) end |