Class: BitClust::SearchResult::Record
- Defined in:
- lib/bitclust/completion.rb
Overview
Wraps an Entry.
Instance Attribute Summary collapse
-
#db ⇒ Object
writeonly
Sets the attribute db.
-
#specs ⇒ Object
readonly
Returns the value of attribute specs.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #class_name ⇒ Object
- #entry ⇒ Object
- #hash ⇒ Object
- #idstring ⇒ Object
- #inherited_method? ⇒ Boolean
-
#initialize(db, spec, origin = nil, entry = nil) ⇒ Record
constructor
A new instance of Record.
- #merge(other) ⇒ Object
- #method_name ⇒ Object
- #method_of_alias_class? ⇒ Boolean
- #name ⇒ Object
- #names ⇒ Object
- #origin ⇒ Object
- #original_name ⇒ Object
- #owned_method? ⇒ Boolean
Constructor Details
#initialize(db, spec, origin = nil, entry = nil) ⇒ Record
Returns a new instance of Record.
485 486 487 488 489 490 |
# File 'lib/bitclust/completion.rb', line 485 def initialize(db, spec, origin = nil, entry = nil) @db = db @specs = [spec] @origin = origin @entry = entry end |
Instance Attribute Details
#db=(value) ⇒ Object (writeonly)
Sets the attribute db
492 493 494 |
# File 'lib/bitclust/completion.rb', line 492 def db=(value) @db = value end |
#specs ⇒ Object (readonly)
Returns the value of attribute specs.
493 494 495 |
# File 'lib/bitclust/completion.rb', line 493 def specs @specs end |
Instance Method Details
#<=>(other) ⇒ Object
544 545 546 |
# File 'lib/bitclust/completion.rb', line 544 def <=>(other) entry() <=> other.entry end |
#==(other) ⇒ Object Also known as: eql?
533 534 535 536 |
# File 'lib/bitclust/completion.rb', line 533 def ==(other) return false if self.class != other.class @idstring == other.idstring end |
#class_name ⇒ Object
521 522 523 |
# File 'lib/bitclust/completion.rb', line 521 def class_name @specs.first.klass end |
#entry ⇒ Object
508 509 510 |
# File 'lib/bitclust/completion.rb', line 508 def entry @entry ||= @db.get_method(origin()) || raise end |
#hash ⇒ Object
540 541 542 |
# File 'lib/bitclust/completion.rb', line 540 def hash @hash ||= idstring().hash end |
#idstring ⇒ Object
504 505 506 |
# File 'lib/bitclust/completion.rb', line 504 def idstring origin().to_s end |
#inherited_method? ⇒ Boolean
561 562 563 |
# File 'lib/bitclust/completion.rb', line 561 def inherited_method? !owned_method?() && !method_of_alias_class?() end |
#merge(other) ⇒ Object
548 549 550 |
# File 'lib/bitclust/completion.rb', line 548 def merge(other) @specs |= other.specs end |
#method_name ⇒ Object
525 526 527 |
# File 'lib/bitclust/completion.rb', line 525 def method_name @specs.first.method end |
#method_of_alias_class? ⇒ Boolean
557 558 559 |
# File 'lib/bitclust/completion.rb', line 557 def method_of_alias_class? entry.klass.aliases.any?{|aliasclass| aliasclass.name?(class_name())} end |
#name ⇒ Object
512 513 514 |
# File 'lib/bitclust/completion.rb', line 512 def name names().first end |
#names ⇒ Object
516 517 518 519 |
# File 'lib/bitclust/completion.rb', line 516 def names version = @db && @db.properties["version"] @specs.map {|spec| spec.display_name(version) } end |
#origin ⇒ Object
495 496 497 498 499 500 501 502 |
# File 'lib/bitclust/completion.rb', line 495 def origin @origin ||= begin spec = @specs.first c = @db.fetch_class(spec.klass) MethodSpec.parse(c.match_entry(spec.type, spec.method) || raise) end end |
#original_name ⇒ Object
529 530 531 |
# File 'lib/bitclust/completion.rb', line 529 def original_name @idstring end |
#owned_method? ⇒ Boolean
553 554 555 |
# File 'lib/bitclust/completion.rb', line 553 def owned_method? @specs.any? {|spec| spec.klass == origin().klass } end |