module FileStrModule

{FileStr} class related module which maps missing methods to {FileStr} defined methods.

Public Instance Methods

method_missing( m, *args, &block ) click to toggle source

Call FileStr supported methods (if available).

# 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
s_chmod( mode_int ) click to toggle source

Chmod with mode_int.

@param mode_int [Integer] New file mode.

# File lib/filestr.rb, line 34
def s_chmod( mode_int )
    File.chmod( mode_int, self )
end
s_chown( owner_int, group_int ) click to toggle source

Chown with owner_int, group_int.

@param owner_int [Integer] New file owner. @param group_int [Integer] New file group.

# 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 ) click to toggle source

Fnmatch to pattern with flags.

@param pattern [String] Glob patttern for matching. @param flags [Constant] Flags for matching.

# File lib/filestr.rb, line 50
def s_fnmatch( pattern, *flags )
    File.fnmatch( pattern, self, *flags )
end
s_glob( pattern = "", *args, &block ) click to toggle source

Glob with self as base string.

@param pattern [String] Suffix of glob pattern (concat to self).

# File lib/filestr.rb, line 61
def s_glob( pattern = "", *args, &block )
    Dir.glob( self + pattern, *args, &block )
end