Class: PulpProxy::DiskUsage
- Inherits:
-
Object
- Object
- PulpProxy::DiskUsage
- Includes:
- Proxy::Log, Proxy::Util
- Defined in:
- lib/smart_proxy_pulp_plugin/disk_usage.rb
Constant Summary collapse
- SIZE =
{ :byte => 1, :kilobyte => 1_024, :megabyte => 1_048_576, :gigabyte => 1_073_741_824, :terabyte => 1_099_511_627_776 }
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#stat ⇒ Object
readonly
Returns the value of attribute stat.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ DiskUsage
constructor
A new instance of DiskUsage.
- #to_json ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ DiskUsage
Returns a new instance of DiskUsage.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/smart_proxy_pulp_plugin/disk_usage.rb', line 9 def initialize(opts ={}) raise(::Proxy::Error::ConfigurationError, 'Unable to continue - must provide a path.') if opts[:path].nil? @paths_hash = validate_path(path_hash(opts[:path])) @path = @paths_hash.values @size_format = opts[:size] || :kilobyte @size = SIZE[@size_format] @stat = {} find_df get_stat end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/smart_proxy_pulp_plugin/disk_usage.rb', line 7 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
7 8 9 |
# File 'lib/smart_proxy_pulp_plugin/disk_usage.rb', line 7 def size @size end |
#stat ⇒ Object (readonly)
Returns the value of attribute stat.
7 8 9 |
# File 'lib/smart_proxy_pulp_plugin/disk_usage.rb', line 7 def stat @stat end |
Instance Method Details
#to_json ⇒ Object
20 21 22 |
# File 'lib/smart_proxy_pulp_plugin/disk_usage.rb', line 20 def to_json stat.to_json end |