Module: FunWith::Files::StringBehavior

Defined in:
lib/fun_with/files/string_behavior.rb

Instance Method Summary collapse

Instance Method Details

#!~(rhs) ⇒ Object



10
11
12
# File 'lib/fun_with/files/string_behavior.rb', line 10

def !~( rhs )
  @path !~ rhs
end

#=~(rhs) ⇒ Object



6
7
8
# File 'lib/fun_with/files/string_behavior.rb', line 6

def =~( rhs )
  @path =~ rhs
end

#gsub(*args) ⇒ Object

gsub acts on the filepath, not the file contents



19
20
21
# File 'lib/fun_with/files/string_behavior.rb', line 19

def gsub( *args )
  @path.gsub(*args).fwf_filepath
end

#gsub!(*args) ⇒ Object



23
24
25
# File 'lib/fun_with/files/string_behavior.rb', line 23

def gsub!( *args )
  @path = @path.gsub(*args)
end

#match(*args) ⇒ Object



14
15
16
# File 'lib/fun_with/files/string_behavior.rb', line 14

def match( *args )
  @path.match( *args )
end

#scan(*args, &block) ⇒ Object



27
28
29
# File 'lib/fun_with/files/string_behavior.rb', line 27

def scan( *args, &block )
  @path.scan( *args, &block )
end

#to_strObject

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



32
33
34
# File 'lib/fun_with/files/string_behavior.rb', line 32

def to_str
  @path.dup
end