Class: Looksee::LookupPath

Inherits:
Object show all
Defined in:
lib/looksee.rb

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ LookupPath

Returns a new instance of LookupPath.



162
163
164
# File 'lib/looksee.rb', line 162

def initialize(entries)
  @entries = entries
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



160
161
162
# File 'lib/looksee.rb', line 160

def entries
  @entries
end

Class Method Details

.for(object, options = {}) ⇒ Object

Create a LookupPath for the given object.

Options may be given to restrict which visibilities are included.

:public
:protected
:private
:undefined
:overridden


178
179
180
181
# File 'lib/looksee.rb', line 178

def self.for(object, options={})
  entries = entries_for(object, options)
  new(entries)
end

Instance Method Details

#grep(pattern) ⇒ Object

Return a new LookupPath which only contains names matching the given pattern.



187
188
189
190
191
192
# File 'lib/looksee.rb', line 187

def grep(pattern)
  entries = self.entries.map do |entry|
    entry.grep(pattern)
  end
  self.class.new(entries)
end

#inspect(options = {}) ⇒ Object



194
195
196
197
# File 'lib/looksee.rb', line 194

def inspect(options={})
  options = normalize_inspect_options(options)
  entries.map{|e| e.inspect(options)}.join("\n")
end