irb-kit 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c77d7eb5845448c9e3050a2106ba4fd1a032f4027f7de2ee1209dfaa12aef203
4
- data.tar.gz: '0281f3ab1ab7f7f3d9f0da865b795b8d6d65703d1d70eac18b047269c9345fab'
3
+ metadata.gz: bd95b94c3b604ba8c6c5c239475a99ab603815ba86d98587193063515b676fd2
4
+ data.tar.gz: e2082fe9b9e281291c2e67ec6b54e2ea7359c50178d625cf96faa05ce225ece8
5
5
  SHA512:
6
- metadata.gz: 68577f28ddbadd851506efd218f4f8fa9fb755fa80a92b1617712d75494c081bc0251bc087dbe72161a6171ac48a10efb7e6c116d06ffbf63466c89f19f334b4
7
- data.tar.gz: 7a1e64278796fa5b7685eae916f5b44b078501b38f89ea124dc0d103b2ffaeb20118486d33132f29aa4e192c802aecfea7256f3a4b39f53bae7e3c9112cb5414
6
+ metadata.gz: a5bbb32382af12000c59e762774961637a00285f55355eed10d7feead6d6f015397661ec99a9ad0e29e7036a26cc938b89c3aa75ee6d96b1d2c0e6fd4c9f77bf
7
+ data.tar.gz: cc2472d1fd8069b751816de1f5c62574236dc999b59c380b886b5e2e0b1b5a8911935fe2c6b2fc9e9b738e9626f6c78699ae3d16d25bae5c5ff3ea63778b5837
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -9,6 +9,7 @@
9
9
  :rails_link: link:https://rubyonrails.org[Rails]
10
10
  :ruby_link: link:https://www.ruby-lang.org[Ruby]
11
11
  :xdg_link: link:https://alchemists.io/projects/xdg[XDG]
12
+ :iterm_link: link:https://iterm2.com[iTerm2]
12
13
 
13
14
  = IRB Kit
14
15
 
@@ -34,7 +35,7 @@ To install _with_ security, run:
34
35
  [source,bash]
35
36
  ----
36
37
  # 💡 Skip this line if you already have the public certificate installed.
37
- gem cert --add <(curl --compressed --location https://alchemists.io/projects/irb-kit/gems.pem)
38
+ gem cert --add <(curl --compressed --location https://alchemists.io/gems.pem)
38
39
  gem install irb-kit --trust-policy HighSecurity
39
40
  ----
40
41
 
@@ -160,11 +161,11 @@ Use this helper, short for _constant source_, to find the source location of a c
160
161
 
161
162
  [source,ruby]
162
163
  ----
163
- csource :RUBY_VERSION # ["<main>", 0]
164
- csource "RUBY_VERSION" # ["<main>", 0]
164
+ csource :RUBY_DESCRIPTION # "$HOME/.cache/frum/versions/3.3.2/bin/ruby:0"
165
+ csource "RUBY_DESCRIPTION" # "$HOME/.cache/frum/versions/3.3.2/bin/ruby:0"
165
166
  ----
166
167
 
167
- You can use a symbol or a string when looking up the source location of a constant.
168
+ You can use a symbol or a string when looking up the source location of a constant. The output is formatted so you can use pass:[<kbd>CONTROL</kbd>] + `<click>` to immediately view the source at the exact line number in consoles like {iterm_link}.
168
169
 
169
170
  ==== `msource`
170
171
 
@@ -172,11 +173,13 @@ Use this helper, short for _method source_, to find the source location of a met
172
173
 
173
174
  [source,ruby]
174
175
  ----
175
- msource IRB, :start # ["ruby/gems/3.3.0/gems/irb-1.13.1/lib/irb.rb", 893]
176
- msource IRB, "start" # ["ruby/gems/3.3.0/gems/irb-1.13.1/lib/irb.rb", 893]
176
+ msource IRB, :start # "$HOME/.cache/frum/versions/3.3.2/lib/ruby/3.3.0/irb.rb:893"
177
+ msource IRB, "start" # "$HOME/.cache/frum/versions/3.3.2/lib/ruby/3.3.0/irb.rb:893"
177
178
  ----
178
179
 
179
- The first argument is the object you want to message while the second argument is the object's method you want to find the source code location for. You'll get an array with the path and the line number of the method's source. You can also use a symbol or string for the method.
180
+ The first argument is the object you want to message while the second argument is the object's method you want to find the source code location for. You can also use a symbol or string for the method.
181
+
182
+ The output is formatted so you can use pass:[<kbd>CONTROL</kbd>] + `<click>` to immediately view the source at the exact line number in consoles like {iterm_link}.
180
183
 
181
184
  ==== `paste`
182
185
 
data/irb-kit.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "irb-kit"
5
- spec.version = "0.1.0"
5
+ spec.version = "0.2.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/irb-kit"
@@ -9,20 +9,21 @@ module IRB
9
9
 
10
10
  description "Find a constant's source location."
11
11
 
12
- def initialize object = Object
12
+ def initialize object = Object, delimiter: ":"
13
13
  super()
14
14
  @object = object
15
+ @delimiter = delimiter
15
16
  end
16
17
 
17
18
  def execute name
18
- object.const_source_location name
19
+ object.const_source_location(name).then { |details| details.join delimiter if details }
19
20
  rescue NameError
20
21
  "ERROR: Invalid constant (#{name.inspect})."
21
22
  end
22
23
 
23
24
  private
24
25
 
25
- attr_reader :object
26
+ attr_reader :object, :delimiter
26
27
  end
27
28
  end
28
29
  end
@@ -9,11 +9,20 @@ module IRB
9
9
 
10
10
  description "Find an object method's source location."
11
11
 
12
+ def initialize delimiter: ":"
13
+ super()
14
+ @delimiter = delimiter
15
+ end
16
+
12
17
  def execute object, name
13
- object.method(name).source_location
18
+ object.method(name).source_location.then { |details| details.join delimiter if details }
14
19
  rescue NameError => error
15
20
  "ERROR: #{error.message}"
16
21
  end
22
+
23
+ private
24
+
25
+ attr_reader :delimiter
17
26
  end
18
27
  end
19
28
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module IRB
4
4
  module Kit
5
- # Loads IRB extensions for namespace.
5
+ # Loads extensions for namespace.
6
6
  class Loader
7
7
  ALL = [:all].freeze
8
8
 
@@ -18,15 +18,15 @@ module IRB
18
18
 
19
19
  attr_reader :registrar, :namespace, :all
20
20
 
21
- def register_all = helpers.each { |helper| registrar.register helper::MONIKER, helper }
21
+ def register_all = constants.each { |helper| registrar.register helper::MONIKER, helper }
22
22
 
23
23
  def register_selected(*monikers)
24
- helpers.select { |helper| monikers.include? helper::MONIKER }
25
- .then { |selected| monikers.zip selected }
26
- .each { |moniker, helper| registrar.register moniker, helper }
24
+ constants.select { |helper| monikers.include? helper::MONIKER }
25
+ .then { |selected| monikers.zip selected }
26
+ .each { |moniker, helper| registrar.register moniker, helper }
27
27
  end
28
28
 
29
- def helpers = namespace.constants.sort.map { |name| namespace.const_get name }
29
+ def constants = namespace.constants.sort.map { |name| namespace.const_get name }
30
30
  end
31
31
  end
32
32
  end
@@ -14,7 +14,7 @@ module IRB
14
14
  end
15
15
 
16
16
  def call
17
- if defined? Hanami
17
+ if defined?(Hanami) && defined?(Hanami::VERSION)
18
18
  details Hanami::VERSION, Hanami.app.name.delete_suffix("::App"), Hanami.env
19
19
  elsif defined? Rails
20
20
  details Rails.version, Rails.application.class.module_parent_name, Rails.env
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irb-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-05-23 00:00:00.000000000 Z
38
+ date: 2024-05-31 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: irb
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.5.10
114
+ rubygems_version: 3.5.11
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Extends IRB by providing additional productivity enhancements.
metadata.gz.sig CHANGED
Binary file