README.md in refinements-7.0.0 vs README.md in refinements-7.1.0
- old
+ new
@@ -47,12 +47,16 @@
- Provides DateTime refinements:
- `.utc` - Answers new DateTime object for current UTC date/time.
- Provides BigDecimal refinements:
- `#inspect` - Allows one to inspect a big decimal with numeric representation.
- Provides File refinements:
- - `.rewrite` - When given a file path and a block, it provides the contents of the recently read
+ - `#name` - Answers the *name* of file without extension.
+ - `#copy` - Copies an existing file to new file. Both directory structures must exist.
+ - `#rewrite` - When given a file path and a block, it provides the contents of the recently read
file for manipulation and immediate writing back to the same file.
+ - `#touch` - Updates the access and modified times of an existing file or creates the file when
+ not existing.
- Provides Hash refinements:
- `#except` - Answers new hash with given keys removed without modifying calling hash.
- `#except!` - Answers new hash with given keys removed while modifying calling hash.
- `#symbolize_keys` - Converts keys to symbols without modifying itself.
- `#symbolize_keys!` - Converts keys to symbols while modifying itself.
@@ -76,11 +80,11 @@
- `#use` - Provides hash value computation, via a block, by using
only the keys as arguments to the block.
## Requirements
-1. [Ruby 2.6.x](https://www.ruby-lang.org).
+1. [Ruby 2.7.x](https://www.ruby-lang.org).
1. A solid understanding of [Ruby refinements and lexical scope](https://www.youtube.com/watch?v=qXC9Gk4dCEw).
## Setup
Type the following to install:
@@ -194,10 +198,17 @@
example = {unit: "221B", street: "Baker Street", city: "London", country: "UK"}
example.use { |unit, street| "#{unit} #{street}" } # => "221B Baker Street"
#### Pathname
+ Pathname("test.txt").name # => Pathname("test")
+
+ Pathname("input.txt").copy Pathname("output.txt")
+
Pathname("/test.txt").rewrite { |content| content.sub "[placeholder]", "example" }
+
+ Pathname("test.txt").touch
+ Pathname("test.txt").touch accessed_at: Time.now - 1, modified_at: Time.now - 1
#### String
"example".first # => "e"
"example".first 4 # => "exam"