Skip to content
Fluent API for pleasant file IO
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Bump version number to 1.2.0 Jul 18, 2018
test Add Pathname#chdir Jul 18, 2018
.gitignore bundle gem pleasant_path Oct 25, 2016
.travis.yml bundle gem pleasant_path Oct 25, 2016
CHANGELOG.md Add CHANGELOG Jul 18, 2018
Gemfile bundle gem pleasant_path Oct 25, 2016
LICENSE.txt Edit license Oct 25, 2016
README.md Add Pathname#chdir Jul 18, 2018
Rakefile Add rake doc task Oct 25, 2016
pleasant_path.gemspec Edit gemspec Oct 25, 2016

README.md

pleasant_path

A fluent API for pleasant file IO, written as extensions to core Ruby objects. See API listing below, or browse the full documentation.

Examples

# Filter lines across multiple files
"logs/*.txt".glob.each do |log|
  log.read_lines.grep(/^ERROR /).append_to_file("errors.txt")
end

# Dedup lines in a file
"names.txt".path.edit_lines(&:uniq)

Core API

The following methods are available:

JSON-related and YAML-related API

pleasant_path also includes methods for interacting with JSON and YAML files, using the JSON module and YAML module that are part of Ruby's standard library. Because Ruby does not load these modules by default, pleasant_path does not load its JSON-related and YAML-related API by default either. To load these pleasant_path APIs and the relevant standard library modules, use:

require "pleasant_path/json"
require "pleasant_path/yaml"

The following methods are available:

Installation

Install from Ruby Gems:

$ gem install pleasant_path

Then require in your Ruby script:

require "pleasant_path"

Contributing

Run rake test to run the tests. You can also run rake irb for an interactive prompt that pre-loads the project code.

License

MIT License

You can’t perform that action at this time.