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, #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

#initialize(model_selector, display_page) ⇒ Page

Returns a new instance of Page.



60
61
62
63
# File 'lib/metaruby/gui/model_browser.rb', line 60

def initialize(model_selector, display_page)
    super(display_page)
    @model_selector = model_selector
end

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)


68
69
70
71
72
73
74
# File 'lib/metaruby/gui/model_browser.rb', line 68

def uri_for(object)
    if resolver = @model_selector.find_resolver_from_model(object)
        "/" + resolver.split_name(object).join("/")
    else
        super
    end
end