module FunWith::Files::StringBehavior

Public Instance Methods

=~( rval ) click to toggle source
# File lib/fun_with/files/string_behavior.rb, line 6
def =~( rval )
  @path =~ rval
end
gsub( *args ) click to toggle source

gsub acts on the filepath, not the file contents

# File lib/fun_with/files/string_behavior.rb, line 15
def gsub( *args )
  @path.gsub(*args).fwf_filepath
end
gsub!( *args ) click to toggle source
# File lib/fun_with/files/string_behavior.rb, line 19
def gsub!( *args )
  @path = @path.gsub(*args)
end
match( *args ) click to toggle source
# File lib/fun_with/files/string_behavior.rb, line 10
def match( *args )
  @path.match( *args )
end
scan( *args, &block ) click to toggle source
# File lib/fun_with/files/string_behavior.rb, line 23
def scan( *args, &block )
  @path.scan( *args, &block )
end
to_str() click to toggle source

Lets it be a string when a string is called for. Replacement argument in .gsub(), for example.

# File lib/fun_with/files/string_behavior.rb, line 28
def to_str
  @path.dup
end