Class: Haconiwa::CGroup
- Inherits:
-
Object
- Object
- Haconiwa::CGroup
- Defined in:
- lib/haconiwa/cgroup.rb
Instance Attribute Summary collapse
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ CGroup
constructor
A new instance of CGroup.
- #register_all!(to: nil) ⇒ Object
- #to_dirs ⇒ Object
Constructor Details
#initialize ⇒ CGroup
Returns a new instance of CGroup.
5 6 7 |
# File 'lib/haconiwa/cgroup.rb', line 5 def initialize @groups = {} end |
Instance Attribute Details
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
8 9 10 |
# File 'lib/haconiwa/cgroup.rb', line 8 def groups @groups end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/haconiwa/cgroup.rb', line 10 def [](key) @groups[key] end |
#[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/haconiwa/cgroup.rb', line 14 def []=(key, value) @groups[key] = value end |
#register_all!(to: nil) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/haconiwa/cgroup.rb', line 22 def register_all!(to: nil) cg = SmallCgroup.new(name: to) groups.each do |k, v| cg.register k, v end end |
#to_dirs ⇒ Object
18 19 20 |
# File 'lib/haconiwa/cgroup.rb', line 18 def to_dirs groups.keys.map{|k| k.split('.').first }.uniq end |