Class: Ucode::Cli::Lookup

Inherits:
Thor
  • Object
show all
Defined in:
lib/ucode/cli.rb

Overview

─────────────── lookup ───────────────

Instance Method Summary collapse

Instance Method Details

#block(codepoint) ⇒ Object



164
165
166
167
168
169
170
171
172
# File 'lib/ucode/cli.rb', line 164

def block(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new.lookup_block(
      VersionResolver.resolve(options[:version]), codepoint: cp,
    )
    puts "#{format("U+%04X", cp)}#{result.block || "(unassigned)"}"
  end
end

#char(codepoint) ⇒ Object



189
190
191
192
193
194
195
196
197
# File 'lib/ucode/cli.rb', line 189

def char(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new
      .lookup_char(VersionResolver.resolve(options[:version]),
                   codepoint: cp, output_root: options[:from])
    puts "#{format("U+%04X", cp)} block=#{result.block_id} glyph=#{result.glyph_path}"
  end
end

#script(codepoint) ⇒ Object



176
177
178
179
180
181
182
183
184
# File 'lib/ucode/cli.rb', line 176

def script(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new.lookup_script(
      VersionResolver.resolve(options[:version]), codepoint: cp,
    )
    puts "#{format("U+%04X", cp)}#{result.script || "(none)"}"
  end
end