Class: Serverspec::Type::Cgroup
- Defined in:
- lib/serverspec/type/cgroup.rb
Instance Attribute Summary collapse
-
#subsystem ⇒ Object
Returns the value of attribute subsystem.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Serverspec::Type::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/serverspec/type/cgroup.rb', line 5 def method_missing(meth) if @subsystem.nil? @subsystem = meth.to_s self else param = "#{@subsystem}.#{meth.to_s}" ret = backend.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'") val = ret.stdout.strip val = val.to_i if val.match(/^\d+$/) val end end |
Instance Attribute Details
#subsystem ⇒ Object
Returns the value of attribute subsystem.
4 5 6 |
# File 'lib/serverspec/type/cgroup.rb', line 4 def subsystem @subsystem end |