Class: RFuse::StatVfs
- Inherits:
-
Object
- Object
- RFuse::StatVfs
- Defined in:
- lib/rfuse/statvfs.rb
Overview
Helper class to return from :statfs (eg for df output) All attributes are Integers and default to 0
Instance Attribute Summary collapse
- #f_bavail ⇒ Integer
- #f_bfree ⇒ Integer
- #f_blocks ⇒ Integer
- #f_bsize ⇒ Integer
- #f_favail ⇒ Integer
- #f_ffree ⇒ Integer
- #f_files ⇒ Integer
- #f_flag ⇒ Integer
- #f_frsize ⇒ Integer
- #f_fsid ⇒ Integer
- #f_namemax ⇒ Integer
Instance Method Summary collapse
-
#initialize(values = {}) ⇒ StatVfs
constructor
values can be symbols or strings but drop the pointless f_ prefix.
- #method_missing(method, *args) ⇒ Object
- #respond_to_missing?(method, private = false) ⇒ Boolean
Constructor Details
#initialize(values = {}) ⇒ StatVfs
values can be symbols or strings but drop the pointless f_ prefix
13 14 15 16 17 18 19 20 21 |
# File 'lib/rfuse/statvfs.rb', line 13 def initialize(values = {}) @f_bsize, @f_frsize, @f_blocks, @f_bfree, @f_bavail, @f_files, @f_ffree, @f_favail, @f_fsid, @f_flag, @f_namemax = Array.new( 13, 0 ) values.each_pair do |k, v| prefix = k.to_s.start_with?('f_') ? '' : 'f_' instance_variable_set("@#{prefix}#{k}", v) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
27 28 29 30 31 |
# File 'lib/rfuse/statvfs.rb', line 27 def method_missing(method, *args) return super if method.start_with?('f_') send("f_#{method}", *args) end |
Instance Attribute Details
#f_bavail ⇒ Integer
7 8 9 |
# File 'lib/rfuse/statvfs.rb', line 7 def f_bavail @f_bavail end |
#f_bfree ⇒ Integer
7 8 9 |
# File 'lib/rfuse/statvfs.rb', line 7 def f_bfree @f_bfree end |
#f_blocks ⇒ Integer
7 8 9 |
# File 'lib/rfuse/statvfs.rb', line 7 def f_blocks @f_blocks end |
#f_bsize ⇒ Integer
7 8 9 |
# File 'lib/rfuse/statvfs.rb', line 7 def f_bsize @f_bsize end |
#f_favail ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_favail @f_favail end |
#f_ffree ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_ffree @f_ffree end |
#f_files ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_files @f_files end |
#f_flag ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_flag @f_flag end |
#f_frsize ⇒ Integer
7 8 9 |
# File 'lib/rfuse/statvfs.rb', line 7 def f_frsize @f_frsize end |
#f_fsid ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_fsid @f_fsid end |
#f_namemax ⇒ Integer
10 11 12 |
# File 'lib/rfuse/statvfs.rb', line 10 def f_namemax @f_namemax end |
Instance Method Details
#respond_to_missing?(method, private = false) ⇒ Boolean
23 24 25 |
# File 'lib/rfuse/statvfs.rb', line 23 def respond_to_missing?(method, private=false) !method.start_with?('f_') && respond_to?("f_#{method}", private) end |