Class: BitClust::TemplateScreen
- Includes:
- HTMLUtils, Translatable, VersionBadges
- Defined in:
- lib/bitclust/screen.rb
Direct Known Subclasses
EntryBoundScreen, IndexScreen, MethodScreen, OpenSearchDescriptionScreen
Constant Summary
Constants included from VersionBadges
VersionBadges::SINCE_CATALOG_KEY, VersionBadges::SINCE_CSS_CLASS, VersionBadges::UNTIL_CATALOG_KEY, VersionBadges::UNTIL_CSS_CLASS
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 Method Summary collapse
- #content_type ⇒ Object
- #encoding ⇒ Object
-
#eol_warning? ⇒ Boolean
True when the build was told (via statichtml --eol-warning) that the documented Ruby version is no longer maintained.
- #google_tag_manager ⇒ Object
-
#initialize(h) ⇒ TemplateScreen
constructor
A new instance of TemplateScreen.
- #meta_description ⇒ Object
- #meta_robots ⇒ Object
- #ruby_version ⇒ Object
-
#run_ruby_wasm_url ⇒ Object
URL of the ruby.wasm module used by the in-browser RUN button on Ruby sample code (statichtml --run-ruby-wasm).
Methods included from VersionBadges
#heading_version_badges, #row_version_badges
Methods included from NameUtils
build_method_id, classid2name, classname2id, classname?, decodeid, decodename_fs, decodename_url, display_typemark, 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?
Methods inherited from Screen
Constructor Details
#initialize(h) ⇒ TemplateScreen
Returns a new instance of TemplateScreen.
271 272 273 274 275 276 277 278 |
# File 'lib/bitclust/screen.rb', line 271 def initialize(h) @urlmapper = h[:urlmapper] @template_repository = h[:template_repository] @default_encoding = h[:default_encoding] || h[:database].propget('encoding') @target_version = h[:target_version] || h[:database].propget('version') h[:message_catalog] @conf = h end |
Instance Method Details
#content_type ⇒ Object
280 281 282 |
# File 'lib/bitclust/screen.rb', line 280 def content_type "text/html; charset=#{encoding()}" end |
#encoding ⇒ Object
284 285 286 |
# File 'lib/bitclust/screen.rb', line 284 def encoding default_encoding() end |
#eol_warning? ⇒ Boolean
True when the build was told (via statichtml --eol-warning) that the documented Ruby version is no longer maintained.
321 322 323 |
# File 'lib/bitclust/screen.rb', line 321 def eol_warning? !!@conf[:eol_warning] end |
#google_tag_manager ⇒ Object
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/bitclust/screen.rb', line 292 def google_tag_manager tracking_id = @conf[:gtm_tracking_id] return "" unless tracking_id <<-HTML.chomp <!-- Global Site Tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=#{tracking_id}"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments)}; gtag('js', new Date()); gtag('config', '#{tracking_id}'); </script> HTML end |
#meta_description ⇒ Object
315 316 317 |
# File 'lib/bitclust/screen.rb', line 315 def %Q(<meta name="description" content="">) end |
#meta_robots ⇒ Object
308 309 310 311 312 313 |
# File 'lib/bitclust/screen.rb', line 308 def content = @conf[:meta_robots_content] return "" unless content return "" if content.empty? %Q(<meta name="robots" content="#{content.join(',')}">) end |
#ruby_version ⇒ Object
288 289 290 |
# File 'lib/bitclust/screen.rb', line 288 def ruby_version @target_version || 'unknown' end |
#run_ruby_wasm_url ⇒ Object
URL of the ruby.wasm module used by the in-browser RUN button on Ruby sample code (statichtml --run-ruby-wasm). nil disables the feature.
327 328 329 330 |
# File 'lib/bitclust/screen.rb', line 327 def run_ruby_wasm_url url = @conf[:run_ruby_wasm] #: String? url end |