Class: MetaRuby::GUI::ModelBrowser::Page

Inherits:
HTML::Page
  • Object
show all
Defined in:
lib/metaruby/gui/model_browser.rb

Overview

A Page object tunes to create URIs for objects that are suitable for #model_selector

Constant Summary

Constants inherited from HTML::Page

HTML::Page::ASSETS, HTML::Page::FRAGMENT_TEMPLATE, HTML::Page::LIST_TEMPLATE, HTML::Page::PAGE_BODY_TEMPLATE, HTML::Page::PAGE_TEMPLATE

Instance Attribute Summary

Attributes inherited from HTML::Page

#exception_rendering, #fragments, #head, #object_uris, #page, #page_name, #scripts, #title

Instance Method Summary collapse

Methods inherited from HTML::Page

#add_script, #add_to_head, #add_to_setup, #auto_id, #clear, copy_assets_to, #enable_exception_rendering, #find_button_by_url, #find_first_element, #html, #html_body, #html_fragment, #initialize, #link_to, #load_javascript, #load_template, main_doc, #main_doc, #pageLinkClicked, #path_in_resource, #push, #push_exception, #render_item, #render_list, #restore, #save, #scale_attribute, to_html, to_html_body, to_html_page, #update_html

Constructor Details

This class inherits a constructor from MetaRuby::GUI::HTML::Page

Instance Method Details

#uri_for(object) ⇒ Object

Overloaded from HTML::Page to resolve object paths (in the

constant hierarchy, e.g. A::B::C) into the corresponding
path expected by {#model_selector} (e.g. /A/B/C)


63
64
65
66
67
68
69
# File 'lib/metaruby/gui/model_browser.rb', line 63

def uri_for(object)
    if object.respond_to?(:name) && (obj_name = object.name) && (obj_name =~ /^[\w:]+$/)
        path = obj_name.split("::")
        "/" + path.join("/")
    else super
    end
end