Class: Looksee::LookupPath
Defined Under Namespace
Classes: Entry
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Class Method Summary collapse
-
.for(object, options = {}) ⇒ Object
Create a LookupPath for the given object.
Instance Method Summary collapse
-
#grep(pattern) ⇒ Object
Return a new LookupPath which only contains names matching the given pattern.
-
#initialize(entries) ⇒ LookupPath
constructor
A new instance of LookupPath.
- #inspect(options = {}) ⇒ Object
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
#entries ⇒ Object (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, ={}) entries = entries_for(object, ) 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(={}) = () entries.map{|e| e.inspect()}.join("\n") end |