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.
158 159 160 |
# File 'lib/looksee.rb', line 158 def initialize(entries) @entries = entries end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
156 157 158 |
# File 'lib/looksee.rb', line 156 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
174 175 176 177 |
# File 'lib/looksee.rb', line 174 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.
183 184 185 186 187 188 |
# File 'lib/looksee.rb', line 183 def grep(pattern) entries = self.entries.map do |entry| entry.grep(pattern) end self.class.new(entries) end |
#inspect(options = {}) ⇒ Object
190 191 192 193 |
# File 'lib/looksee.rb', line 190 def inspect(={}) = () entries.map{|e| e.inspect()}.join("\n") end |