Class: BitClust::URLMapper

Inherits:
Object show all
Includes:
NameUtils
Defined in:
lib/bitclust/screen.rb

Constant Summary

Constants included from NameUtils

NameUtils::CHAR_TO_MARK, NameUtils::CHAR_TO_NAME, NameUtils::CLASS_NAME_RE, NameUtils::CLASS_PATH_RE, NameUtils::CONST_PATH_RE, NameUtils::CONST_RE, NameUtils::GVAR_RE, NameUtils::LIBNAME_RE, NameUtils::MARK_TO_CHAR, NameUtils::MARK_TO_NAME, NameUtils::METHOD_NAME_RE, NameUtils::METHOD_SPEC_RE, NameUtils::MID, NameUtils::NAME_TO_CHAR, NameUtils::NAME_TO_MARK, NameUtils::TYPEMARK_RE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NameUtils

build_method_id, classid2name, classname2id, classname?, decodeid, decodename_fs, decodename_url, encodeid, encodename_fs, encodename_rdocurl, encodename_url, functionname?, gvarname?, html_filename, libid2name, libname2id, libname?, method_spec?, methodid2classid, methodid2libid, methodid2mname, methodid2specparts, methodid2specstring, methodid2typechar, methodid2typemark, methodid2typename, methodname?, split_method_id, split_method_spec, typechar2mark, typechar2name, typechar?, typemark2char, typemark2name, typemark?, typename2char, typename2mark, typename?

Constructor Details

#initialize(h) ⇒ URLMapper

Returns a new instance of URLMapper.


91
92
93
94
95
96
97
# File 'lib/bitclust/screen.rb', line 91

def initialize(h)
  @base_url = h[:base_url]
  @cgi_url = h[:cgi_url]
  @css_url = h[:css_url]
  @favicon_url = h[:favicon_url]
  @theme = h[:theme] || 'default'
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url


99
100
101
# File 'lib/bitclust/screen.rb', line 99

def base_url
  @base_url
end

Instance Method Details

#cgi_urlObject


101
102
103
# File 'lib/bitclust/screen.rb', line 101

def cgi_url
  @cgi_url
end

#class_url(name) ⇒ Object


136
137
138
# File 'lib/bitclust/screen.rb', line 136

def class_url(name)
  "#{@cgi_url}/class/#{classname2id(name)}"
end

#css_urlObject


105
106
107
108
# File 'lib/bitclust/screen.rb', line 105

def css_url
  return @css_url if @css_url
  "#{@base_url}/theme/#{@theme}/style.css"
end

#custom_css_url(css) ⇒ Object


110
111
112
# File 'lib/bitclust/screen.rb', line 110

def custom_css_url(css)
  "#{@base_url}/theme/#{@theme}/#{css}"
end

#custom_js_url(js) ⇒ Object


119
120
121
# File 'lib/bitclust/screen.rb', line 119

def custom_js_url(js)
  "#{@base_url}/theme/#{@theme}/#{js}"
end

#document_url(name) ⇒ Object


165
166
167
168
# File 'lib/bitclust/screen.rb', line 165

def document_url(name)
  raise unless %r!\A[-\w/]+\z! =~ name
  "#{@cgi_url}/#{name}"
end

#favicon_urlObject


123
124
125
126
# File 'lib/bitclust/screen.rb', line 123

def favicon_url
  return @favicon_url if @favicon_url
  "#{@base_url}/theme/#{@theme}/rurema.png"
end

#function_index_urlObject


145
146
147
# File 'lib/bitclust/screen.rb', line 145

def function_index_url
  "#{@cgi_url}/function/"
end

#function_url(name) ⇒ Object


149
150
151
# File 'lib/bitclust/screen.rb', line 149

def function_url(name)
  "#{@cgi_url}/function/#{name}"
end

#js_urlObject


114
115
116
117
# File 'lib/bitclust/screen.rb', line 114

def js_url
  return @js_url if @js_url
  "#{@base_url}/theme/#{@theme}/t.js"
end

#library_index_urlObject


128
129
130
# File 'lib/bitclust/screen.rb', line 128

def library_index_url
  "#{@cgi_url}/library/"
end

#library_url(name) ⇒ Object


132
133
134
# File 'lib/bitclust/screen.rb', line 132

def library_url(name)
  "#{@cgi_url}/library/#{libname2id(name)}"
end

#method_url(spec) ⇒ Object


140
141
142
143
# File 'lib/bitclust/screen.rb', line 140

def method_url(spec)
  cname, tmark, mname = *split_method_spec(spec)
  "#{@cgi_url}/method/#{classname2id(cname)}/#{typemark2char(tmark)}/#{encodename_url(mname)}"
end

#opensearchdescription_urlObject


153
154
155
# File 'lib/bitclust/screen.rb', line 153

def opensearchdescription_url
  "#{@cgi_url}/opensearchdescription"
end

#search_urlObject


157
158
159
# File 'lib/bitclust/screen.rb', line 157

def search_url
  "#{@cgi_url}/search"
end

#spec_url(name) ⇒ Object


161
162
163
# File 'lib/bitclust/screen.rb', line 161

def spec_url(name)
  "#{@cgi_url}/spec/#{name}"
end