Class: BitClust::TerminalView
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
Instance Method Summary collapse
-
#initialize(compiler, opts) ⇒ TerminalView
constructor
A new instance of TerminalView.
- #show_class(cs) ⇒ Object
- #show_function(fs) ⇒ Object
- #show_method(result) ⇒ Object
Constructor Details
#initialize(compiler, opts) ⇒ TerminalView
Returns a new instance of TerminalView.
328 329 330 331 332 333 334 |
# File 'lib/bitclust/searcher.rb', line 328 def initialize(compiler, opts) @compiler = compiler @describe_all = opts[:describe_all] @line = opts[:line] @encoding = opts[:encoding] @database = nil end |
Instance Attribute Details
#database ⇒ Object
Returns the value of attribute database.
336 337 338 |
# File 'lib/bitclust/searcher.rb', line 336 def database @database end |
Instance Method Details
#show_class(cs) ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/bitclust/searcher.rb', line 338 def show_class(cs) if cs.size == 1 if @line print_names [cs.first.label] else describe_class cs.first end else if @describe_all cs.sort.each do |c| describe_class c end else print_names cs.map {|c| c.labels }.flatten end end end |
#show_function(fs) ⇒ Object
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/bitclust/searcher.rb', line 374 def show_function(fs) if fs.size == 1 if @line print_names [fs.first.label] else describe_function fs.first end else if @describe_all fs.sort.each do |f| describe_function f end else print_names fs.map {|f| f.label } end end end |
#show_method(result) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/bitclust/searcher.rb', line 356 def show_method(result) if result.determined? if @line print_names result.names else describe_method result.record end else if @describe_all result.each_record do |rec| describe_method rec end else print_names result.names end end end |