Class: Ucode::Commands::LookupCommand
- Inherits:
-
Object
- Object
- Ucode::Commands::LookupCommand
- Defined in:
- lib/ucode/commands/lookup.rb
Overview
ucode lookup — read-only lookups against the SQLite cache and
the output JSON tree. Three subactions: block, script, char.
Takes a resolved version string; CLI callers resolve via VersionResolver.resolve once and thread it through. See Candidate 4 of the 2026-06-29 architecture review.
Instance Method Summary collapse
- #lookup_block(version, codepoint:) ⇒ BlockResult
- #lookup_char(version, codepoint:, output_root:) ⇒ CharResult
- #lookup_script(version, codepoint:) ⇒ ScriptResult
Instance Method Details
#lookup_block(version, codepoint:) ⇒ BlockResult
26 27 28 29 |
# File 'lib/ucode/commands/lookup.rb', line 26 def lookup_block(version, codepoint:) with_db(version) { |db| db.lookup_block(codepoint) } .then { |block| BlockResult.new(codepoint: codepoint, block: block) } end |
#lookup_char(version, codepoint:, output_root:) ⇒ CharResult
43 44 45 46 47 |
# File 'lib/ucode/commands/lookup.rb', line 43 def lookup_char(version, codepoint:, output_root:) block_id = with_db(version) { |db| db.lookup_block(codepoint) } glyph = block_id ? glyph_path(output_root, block_id, codepoint) : nil CharResult.new(codepoint: codepoint, block_id: block_id, glyph_path: glyph) end |
#lookup_script(version, codepoint:) ⇒ ScriptResult
34 35 36 37 |
# File 'lib/ucode/commands/lookup.rb', line 34 def lookup_script(version, codepoint:) with_db(version) { |db| db.lookup_script(codepoint) } .then { |script| ScriptResult.new(codepoint: codepoint, script: script) } end |