hiiro 0.1.100 → 0.1.101.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cdf6efd70c63c229c4b725326a98734a8c8f90d8bdcc161e5ab9c8ae24a126e
4
- data.tar.gz: fb154e9c6a38f502c832723db590a015219427a4634438510883664d92a12c1c
3
+ metadata.gz: 4527fe0aa477f01194723db640e4b86a0ec1776b95e3abdc8e5434d7646d8c57
4
+ data.tar.gz: 5241c8faa013b8e3df039dbbe863bed8ffe1fa4e08241b75f200fab920c77c8a
5
5
  SHA512:
6
- metadata.gz: 1a54a7a70422bc807f870eb22db43df60d203b8459e41009e0e70842abb07a07cf1c467850dc3202cab5056ecee56d942a84f58c6d34a79caef49a94436e5db7
7
- data.tar.gz: a04e962764a5f1d336de73e49a9c0f059bcdbb120aa11e2e7509e2029ab11abad5577ef152984e99cd3e705fd20ba83f71e1141aa1b741cf8b02cdbafa54161d
6
+ metadata.gz: 6c562bb508e429ce9584a1d2f8e1a1ceca7be83a4535596568460621bc18fa809465f3b6db73e6d9892db44186587d964789d0ec486227f3739bc9fb68285059
7
+ data.tar.gz: a87e98e4b21bdcd588c7f59776c8acee9ddac3e1ef074669e38ee566fc04bdd53cb6c39d3ddf8ee33c75cff26fa73fa924f25d2a0d02fe10528f67722f9f2cfb
data/lib/hiiro/matcher.rb CHANGED
@@ -1,37 +1,43 @@
1
1
  class Hiiro
2
2
  class Matcher
3
3
  class << self
4
- # Prefix matching class methods
4
+ # Prefix matching class methods - return unwrapped values for backward compatibility
5
5
  def find(items, prefix, key: nil, &block)
6
- new(items, key, &block).by_prefix(prefix)
6
+ result = new(items, key, &block).by_prefix(prefix)
7
+ result.first&.item
7
8
  end
8
9
 
9
10
  def find_all(items, prefix, key: nil, &block)
10
- new(items, key, &block).by_prefix(prefix)
11
+ result = new(items, key, &block).by_prefix(prefix)
12
+ result.matches.map(&:item)
11
13
  end
12
14
 
13
15
  def resolve(items, prefix, key: nil, &block)
14
- new(items, key, &block).by_prefix(prefix)
16
+ result = new(items, key, &block).by_prefix(prefix)
17
+ result.resolved&.item
15
18
  end
16
19
 
17
20
  def find_path(items, prefix, key: nil, &block)
18
- new(items, key, &block).find_path(prefix)
21
+ result = new(items, key, &block).find_path(prefix)
22
+ result.first&.item
19
23
  end
20
24
 
21
25
  def find_all_paths(items, prefix, key: nil, &block)
22
- new(items, key, &block).find_all_paths(prefix)
26
+ result = new(items, key, &block).find_all_paths(prefix)
27
+ result.matches.map(&:item)
23
28
  end
24
29
 
25
30
  def resolve_path(items, prefix, key: nil, &block)
26
- new(items, key, &block).resolve_path(prefix)
31
+ result = new(items, key, &block).resolve_path(prefix)
32
+ result.resolved&.item
27
33
  end
28
34
 
29
- # Substring matching class methods
35
+ # Substring matching class methods - returns Result object
30
36
  def by_substring(items, substring, key: nil, &block)
31
37
  new(items, key, &block).by_substring(substring)
32
38
  end
33
39
 
34
- # Prefix matching class methods (explicit)
40
+ # Prefix matching class methods (explicit) - returns Result object
35
41
  def by_prefix(items, prefix, key: nil, &block)
36
42
  new(items, key, &block).by_prefix(prefix)
37
43
  end
data/lib/hiiro/options.rb CHANGED
@@ -10,7 +10,22 @@ class Hiiro
10
10
  new(&block)
11
11
  end
12
12
 
13
+ # Support both: new(&block) for setup, or new(args, &block) for parse
14
+ def self.new(args = nil, &block)
15
+ instance = allocate
16
+ instance.send(:base_initialize, &block)
17
+ if args
18
+ instance.parse!(args)
19
+ else
20
+ instance
21
+ end
22
+ end
23
+
13
24
  def initialize(&block)
25
+ base_initialize(&block)
26
+ end
27
+
28
+ private def base_initialize(&block)
14
29
  @definitions = {}
15
30
  flag(:help, short: 'h', desc: 'Show this help message')
16
31
  instance_eval(&block) if block
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.100"
2
+ VERSION = "0.1.101.pre.1"
3
3
  end
data/lib/hiiro.rb CHANGED
@@ -185,6 +185,7 @@ class Hiiro
185
185
  plugin_const = Kernel.const_get(plugin_const.to_sym)
186
186
  rescue => e
187
187
  puts "unable to load plugin: #{plugin_const}"
188
+ puts "Error message: #{e.message}"
188
189
  return
189
190
  end
190
191
  end
data/plugins/pins.rb CHANGED
@@ -58,7 +58,7 @@ module Pins
58
58
  end
59
59
 
60
60
  def find(partial)
61
- search(partial).match&.item
61
+ search(partial).first&.item
62
62
  end
63
63
 
64
64
  def find_all(partial)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.100
4
+ version: 0.1.101.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: 2.7.0
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - ">"
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: 1.3.1
155
155
  requirements: []
156
156
  rubygems_version: 3.3.7
157
157
  signing_key: