Class: TkInspect::ClassBrowser::ClassTreeDataSource
- Defined in:
- lib/tk_inspect/class_browser/class_tree_data_source.rb
Instance Attribute Summary collapse
-
#class_filter ⇒ Object
Returns the value of attribute class_filter.
Instance Method Summary collapse
- #items_for_path(path) ⇒ Object
- #path_for_class(class_name) ⇒ Object
- #title_for_path(path, items) ⇒ Object
Instance Attribute Details
#class_filter ⇒ Object
Returns the value of attribute class_filter.
4 5 6 |
# File 'lib/tk_inspect/class_browser/class_tree_data_source.rb', line 4 def class_filter @class_filter end |
Instance Method Details
#items_for_path(path) ⇒ Object
6 7 8 9 10 |
# File 'lib/tk_inspect/class_browser/class_tree_data_source.rb', line 6 def items_for_path(path) path = [] if path.blank? parent_class = path.last subclasses_of(parent_class).sort end |
#path_for_class(class_name) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/tk_inspect/class_browser/class_tree_data_source.rb', line 16 def path_for_class(class_name) return unless (klass = Object.const_get(class_name)) path = [class_name] while (klass = klass.superclass) do path.unshift(name_for_class(klass)) end path end |
#title_for_path(path, items) ⇒ Object
12 13 14 |
# File 'lib/tk_inspect/class_browser/class_tree_data_source.rb', line 12 def title_for_path(path, items) "#{items.count} #{'class'.pluralize(items.count)}" end |