| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Fixes #1316
(support XDG Base Directory Specification)
|
|\
| |
| | |
repl: calculate JRuby overhang (or rather not)
|
|/
|
|
|
|
| |
Fixes #1840
(NotImplementedError: vi_editing_mode?() function is unimplemented on this
machine)
|
|\
| |
| | |
gemspec: bump require method_source >= 0.9.1
|
| | |
|
|/
|
|
|
| |
Fixes #1804
(JRuby 9.2.0.0 breaks `source_location` and therefore our test suite)
|
|\
| |
| | |
Deprecate Pry::Platform and introduce Pry::Helpers::Platform
|
|/
|
|
|
|
| |
`Pry::Platform` really looks like a helper and therefore should be defined as
one. Invoking `Pry::Platform` emits a warning now. Users are encouraged to use
`Pry::Helpers::Platform`.
|
|\
| |
| | |
Delete Pry::CommandSet#{before,after}_command
|
|/
|
|
| |
These commands have been deprecated for years. It's high time to get rid of them.
|
|\
| |
| | |
command: delete #source_location
|
|/
|
|
|
| |
This method doesn't seem to be used anywhere, so there's no benefit in keeping
it.
|
|\
| |
| | |
Update copyrights
|
| |
| |
| |
| |
| | |
* Added myself (should've done that years ago)
* Made it look like Pry is a team effort
|
|\ \
| |/
|/| |
prompt: make it possible to set name dynamically
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #1738 (Possible to make prompt_name dynamic?)
The user-facing API is the following:
```rb
Pry.config.prompt_name = Pry.lazy { rand(100) }
[1] 80(main)>
[2] 87(main)>
[3] 30(main)>
```
|
|\
| |
| | |
config: simplify structure
|
|/
|
|
|
|
|
|
|
|
|
| |
* Replace `require_relative` with `require`
The project tries to use the `require` form everywhere where possible, which
is the common form
* `require` from `pry.rb`
Spreaded `require` statements where we require internal classes is confusing
* Fixed namespace definition for Config classes
https://github.com/rubocop-hq/ruby-style-guide#namespace-definition recommends
to use explicit nesting
|
|\
| |
| | |
prompt: refactor to reduce duplication
|
|/
|
|
|
|
|
| |
Since we always need to define two procs that look almost the same, duplication
was unavoidable. With help of method wrappers around procs we can reduce it.
As a bonus, the class has some YARD annotations now.
|
|\
| |
| | |
config/default: rename prompt_safe_objects to prompt_safe_contexts
|
|/
|
|
|
| |
It makes sense to rename it because "objects" we are referring in the context of
prompt are actually prompt "contexts".
|
|\
| |
| | |
Move prompt related code from pry.rb to prompt.rb
|
| |
| |
| |
| |
| | |
It makes a lot more sense to keep these procs under the `Pry::Prompt` namespace
than `Pry`, which is already heavily populated by other various things.
|
|/
|
|
| |
Per https://github.com/rubocop-hq/ruby-style-guide#namespace-definition
|
|\
| |
| | |
pry: move INITIAL_PWD to code/code_file
|
|/
|
|
|
| |
This constant is not used anywhere else but this file so it makes sense to keep
it there.
|
|\
| |
| | |
repl: fix broken input while using rb-readline
|
|/
|
|
| |
Fixes #1823 (Broken upstream when rb-readline is enabled)
|
|\
| |
| | |
cli: fix `-f` not suppressing load of `pryrc`
|
|/
|
|
|
|
|
| |
Fixes #1761 (`pry -f` can no longer suppress the loading of .pryrc)
If I recall correctly, we split session loading in #1393 because of `Pry.start`.
This broke `-f`. I think we can get away with a simple reorder in #parse_options
|
|\
| |
| | |
indent: tidy up #correct_indentation
|
|/ |
|
| |
|
|\
| |
| | |
repl: correctly calculate overhang for empty lines
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This improves on https://github.com/pry/pry/pull/1813.
I spotted a problem with the way it works: sometimes, if you enter an empty
line, the output would span across two lines:
```
[1] pry(main)>
[2] pry(main)>
[3] pry(main)>
```
This is because overhang is bigger than the current line. I also noticed a bug
with method definition, where defining a method leaves an unwanted empty line:
```
[3] pry(main)> def foo
| end
=> :foo
```
To fix this I changed the way we calculate overhang. First and the most
important change is that I stopped calculating overhang for emacs mode. This is
because it's too risky to introduce this change because it's the default mode
and 99% of our users use this, so there's no need to change this
behaviour. Another reason is that emacs mode users typically don't use any mode
indicators (because emacs has no modes), so it strikes me as a more pragmatic
solution.
With Vi mode we calculate overhang and still support custom indicators.
|
|\
| |
| | |
rubocop: fix offences of the Lint/AssignmentInCondition cop
|
|/ |
|
|\
| |
| | |
ring: rewrite the class to improve API
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the Ring class is written with help of Hash as backend store.
According to the comments, the implementation should behave like a circular
buffer, however it doesn't. Upon reaching maximum capacity Ring doesn't replace
old elements but keeps writing to new cells, deleting old cells, so that the
hash contains `nil` entries.
The new implementation is based on Array and seems to be closer to the actual
Ring. Older elemens get overwritten with newer ones.
This class also includes Enumerable, however none of our APIs take advantage of
it, so it seems like an overkill. There was also a problem with with this API
because of the above-mentioned nils. For example, if the ring exceeds its
maximum size, then callin `Enumerable#first` on it returns `nil`.
The new implementation deals with this with removal of Enumerable. The `#[]`
syntax is preserved, and now `ring[0]` returns an actual element instead of
`nil`. In case users need the Enumerable functionality, they can call
`Ring#to_a` to build the array, which supports the wanted methods.
As for the speed, the new implementation is:
* slower overall because it's thread-safe
* faster without mutexes for `#<<`
* slower without mutexes for `#[]`
Benchmark for old implementation:
```
Warming up --------------------------------------
Ring#<< 223.451k i/100ms
Ring#[] 2.837k i/100ms
Calculating -------------------------------------
Ring#<< 223.157B (± 3.4%) i/s - 778.097B
Ring#[] 82.485M (± 9.4%) i/s - 402.602M in 4.957792s
```
Benchmark for this implementation:
```
Warming up --------------------------------------
Ring#<< 211.587k i/100ms
Ring#[] 1.974k i/100ms
Calculating -------------------------------------
Ring#<< 211.385B (± 2.8%) i/s - 698.439B
Ring#[] 40.292M (±17.0%) i/s - 190.069M in 4.971195s
```
The benchmark:
```rb
require './lib/pry'
require 'benchmark/ips'
Benchmark.ips do |x|
empty_ring = Pry::Ring.new(100)
populated_ring = Pry::Ring.new(100)
150.times { |i| populated_ring << i }
x.report("Ring#<<") do |times|
empty_ring << times
end
x.report("Ring#[]") do |times|
populated_ring[0]
populated_ring[1]
populated_ring[2]
populated_ring[-1]
populated_ring[-2]
populated_ring[-3]
populated_ring[1..2]
populated_ring[-2..-1]
populated_ring[-2..3]
populated_ring[0..-1]
populated_ring[2..-1]
populated_ring[-1..10]
populated_ring[-1..0]
populated_ring[-1..1]
end
end
```
|
|
|
|
|
|
|
|
|
|
|
|
| |
I need to add `.ackrc` to help me filter garbage when I search for a string and
get results from built YARD documentation. I don't want to commit the file
itself because not everybody uses ack.
In case you are curious, this is my `.ackrc`:
```
--ignore-dir=doc
```
|
|
|
| |
Fixes #1812
|
|\
| |
| | |
pry_instance: deprecate '#output_array' & '#input_array'
|
|/
|
|
| |
I figured it's better to deprecate them to let plugin authors update their API.
|
|\
| |
| | |
Rename HistoryArray to Ring
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
| |
`HistoryArray` is a very specific name and it doesn't tell the reader what
it *really* means unless you read its code or the docs of the class.
On the other hand, `Ring` is a [very well-known term][1], which means exactly
what `HistoryArray` does. The alias name for it is circular buffer. I chose
`Ring` because it is shorter and used by Golang, so I expect programmers to
be familiar with `Ring`.
[1]: https://en.wikipedia.org/wiki/Circular_buffer
|
|\
| |
| | |
rubocop: disable the Style/NumericPredicate cop
|
|/
|
|
| |
This is very opinionated and not necessary to follow.
|
|\
| |
| | |
rubocop: fix offences of the Style/MultilineTernaryOperator cop
|