Module: FileStrModule
- Included in:
- FileStr
- Defined in:
- lib/filestr.rb
Overview
Instance Method Summary collapse
-
#method_missing(m, *args, &block) ⇒ Object
Call FileStr supported methods (if available).
-
#s_chmod(mode_int) ⇒ Object
Chmod with mode_int.
-
#s_chown(owner_int, group_int) ⇒ Object
Chown with owner_int, group_int.
-
#s_fnmatch(pattern, *flags) ⇒ Object
Fnmatch to pattern with flags.
-
#s_glob(pattern = "", *args, &block) ⇒ Object
Glob with self as base string.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
Call FileStr supported methods (if available).
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/filestr.rb', line 14 def method_missing( m, *args, &block ) klass = FileStr.support[ m ] if klass # Generate the actual class method name. cm = m.to_s[2..-1].to_sym klass.send( cm, self, *args, &block ) else raise NoMethodError end end |
Instance Method Details
#s_chmod(mode_int) ⇒ Object
Chmod with mode_int.
34 35 36 |
# File 'lib/filestr.rb', line 34 def s_chmod( mode_int ) File.chmod( mode_int, self ) end |
#s_chown(owner_int, group_int) ⇒ Object
Chown with owner_int, group_int.
42 43 44 |
# File 'lib/filestr.rb', line 42 def s_chown( owner_int, group_int ) File.chown( owner_int, group_int, self ) end |
#s_fnmatch(pattern, *flags) ⇒ Object
Fnmatch to pattern with flags.
50 51 52 |
# File 'lib/filestr.rb', line 50 def s_fnmatch( pattern, *flags ) File.fnmatch( pattern, self, *flags ) end |
#s_glob(pattern = "", *args, &block) ⇒ Object
Glob with self as base string.
61 62 63 |
# File 'lib/filestr.rb', line 61 def s_glob( pattern = "", *args, &block ) Dir.glob( self + pattern, *args, &block ) end |