Skip to content

Commit

Permalink
Delegate more methods from Candidate back to WrappedModule
Browse files Browse the repository at this point in the history
  • Loading branch information
banister committed Feb 7, 2013
1 parent c0408a0 commit 7260c2e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/pry/module_candidate.rb
Expand Up @@ -20,12 +20,16 @@ class Candidate
attr_reader :line
alias_method :source_line, :line

# Methods to delegate to associated `Pry::WrappedModule instance`.
to_delegate = [:lines_for_file, :method_candidates, :name, :wrapped,
:yard_docs?, :number_of_candidates]
# Methods to delegate to associated `Pry::WrappedModule
# instance`.
private_delegates = [:lines_for_file, :method_candidates,
:yard_docs?, :number_of_candidates]

def_delegators :@wrapper, *to_delegate
private(*to_delegate)
public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name]

def_delegators :@wrapper, *(private_delegates + public_delegates)
private *private_delegates
public *public_delegates

# @raise [Pry::CommandError] If `rank` is out of bounds.
# @param [Pry::WrappedModule] wrapper The associated
Expand Down

0 comments on commit 7260c2e

Please sign in to comment.