Module: FunRuby::File

Extended by:
File
Includes:
Common::Helpers
Included in:
File
Defined in:
lib/fun_ruby/file.rb

Overview

Module containing methods for files

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.write(filepath = F._, content = F._) ⇒ Object

Writes a given content to a given file

Examples:

Basics

tmp = Tempfile.new("file.txt")
F::File.write(tmp.path, "abc")
File.read(tmp.path) #=> "abc"
tmp.unlink

Parameters:

  • filepath (::String) (defaults to: F._)
  • content (::String) (defaults to: F._)

Since:

  • 0.1.0



22
23
24
# File 'lib/fun_ruby/file.rb', line 22

def write(filepath = F._, content = F._)
  curry_implementation(:write, filepath, content)
end

Instance Method Details

#write(filepath = F._, content = F._) ⇒ Object

Writes a given content to a given file

Examples:

Basics

tmp = Tempfile.new("file.txt")
F::File.write(tmp.path, "abc")
File.read(tmp.path) #=> "abc"
tmp.unlink

Parameters:

  • filepath (::String) (defaults to: F._)
  • content (::String) (defaults to: F._)

Since:

  • 0.1.0



22
23
24
# File 'lib/fun_ruby/file.rb', line 22

def write(filepath = F._, content = F._)
  curry_implementation(:write, filepath, content)
end