Module: FunWith::Files::StringBehavior
- Defined in:
- lib/fun_with/files/string_behavior.rb
Instance Method Summary collapse
- #=~(rval) ⇒ Object
-
#gsub(*args) ⇒ Object
gsub acts on the filepath, not the file contents.
- #gsub!(*args) ⇒ Object
- #match(*args) ⇒ Object
- #scan(*args, &block) ⇒ Object
-
#to_str ⇒ Object
Lets it be a string when a string is called for.
Instance Method Details
#=~(rval) ⇒ Object
6 7 8 |
# File 'lib/fun_with/files/string_behavior.rb', line 6 def =~( rval ) @path =~ rval end |
#gsub(*args) ⇒ Object
gsub acts on the filepath, not the file contents
15 16 17 |
# File 'lib/fun_with/files/string_behavior.rb', line 15 def gsub( *args ) @path.gsub(*args).fwf_filepath end |
#gsub!(*args) ⇒ Object
19 20 21 |
# File 'lib/fun_with/files/string_behavior.rb', line 19 def gsub!( *args ) @path = @path.gsub(*args) end |
#match(*args) ⇒ Object
10 11 12 |
# File 'lib/fun_with/files/string_behavior.rb', line 10 def match( *args ) @path.match( *args ) end |
#scan(*args, &block) ⇒ Object
23 24 25 |
# File 'lib/fun_with/files/string_behavior.rb', line 23 def scan( *args, &block ) @path.scan( *args, &block ) end |
#to_str ⇒ Object
Lets it be a string when a string is called for. Replacement argument in .gsub(), for example.
28 29 30 |
# File 'lib/fun_with/files/string_behavior.rb', line 28 def to_str @path.dup end |