Are you looking for the following?
File.open(yourfile, 'w') { |file| file.write("your text") }
More Related Contents:
- How to search file text for a pattern and replace it with a given value
- What are all the common ways to read a file in Ruby?
- What are the Ruby File.open modes and options?
- How to search a folder and all of its subfolders for files of a certain type
- Reading the last n lines of a file in Ruby?
- Read binary file as string in Ruby
- How to get the last character of a string in an array [closed]
- Compute percentage of cents total
- What does ||= (or-equals) mean in Ruby?
- How to remove RVM (Ruby Version Manager) from my system
- Why use Ruby’s attr_accessor, attr_reader and attr_writer?
- Can’t install Ruby under Lion with RVM – GCC issues
- What does !! mean in ruby?
- Why doesn’t ruby support method overloading?
- What’s the difference between URI.escape and CGI.escape?
- ‘pass parameter by reference’ in Ruby?
- How to Uninstall RVM? [duplicate]
- Backslashes in single quoted strings vs. double quoted strings
- Is there any wisdom behind “and”, “or” operators in Ruby?
- ruby inheritance vs mixins
- Library not loaded: /opt/local/lib/libssl.1.0.0.dylib (LoadError)
- Understanding the “||” OR operator in If conditionals in Ruby
- In Ruby, how does coerce() actually work?
- How to check if a Ruby object is a Boolean
- How can I access a variable defined in a Ruby file I required in IRB?
- Invalid function in ruby
- How to check if a directory/file/symlink exists with one command in Ruby
- Split string by multiple delimiters
- Transliteration in ruby
- How to match something with regex that is not between two special characters?