Class: Cyberweb::Objectified::HtmlTags::WebObject

Inherits:
Base
  • Object
show all
Includes:
Mask
Defined in:
lib/cyberweb/objectified/web_object/web_object.rb

Overview

Cyberweb::Objectified::HtmlTags::WebObject

Constant Summary

Constants inherited from Base

Base::HOME_DIRECTORY_OF_THE_USER_X, Base::NAMESPACE

Instance Method Summary collapse

Methods inherited from Base

#be_verbose, #be_verbose?, #cascading_style_sheets_directory?, #cd, #commandline_mode?, #copyright?, #css_comment, #delete_directory, #do_toggle, #e, #echo_raw, #filename?, #full_path_to_image_directory?, #html_colours?, #html_image, #htmlentities, #img_dir?, #infer_the_namespace, #initialize_the_configuration, #is_a_file?, #is_a_video_file?, #is_an_image_file?, #is_on_roebe?, #last_tag_used?, #last_tag_used_first_element?, #last_tag_used_id?, #mkdir, #mode?, #namespace?, #open_in_browser, #opne, #opnn, #remove_comments_from_this_string_but_preserve_CSS_rules, #remove_html, #return_all_directories, #return_date, #return_program_name, #return_pwd, #ruby_header?, #server_base_directory?, #set_commandline_mode, #set_last_tag_used, #update_the_image_directory, #use_this_relative_directory_for_custom_images?, #www_mode?

Methods included from BaseModule::FileRelatedFunctionality

#copy_this_file, #cpr, #delete_file, #filename_without_extension?, #read_file_via_utf8_encoding

Methods included from BaseModule

#attach_these_constants, #base_dir?, #beautiful_url, #cd, #create_the_internal_hash, #doctype?, #ee, #ensure_main_encoding, #esystem, #html_templates, #initialize_the_config_if_the_config_hash_is_empty, #internal_hash?, #log_dir?, #no_http, #random_alphabet_characters, #rarrow?, #rds, #remove_comments_from_this_string, #remove_numbers, #require_the_html_templates, #require_these, #return_file_size_in_kb_of, #return_html_comment, #ruby_sitelib_dir?, #sanitize_this_id, #server_base_directory?, #string_remote_image, #today?, #try_to_require_rack, #try_to_require_the_open_gem, #write_what_into

Methods included from BaseModule::ContentType

#content_type_is_html, #content_type_is_jpeg, #content_type_is_json, #content_type_is_plain_text

Methods included from BaseModule::CommandlineArguments

#append_to_the_commandline_arguments, #commandline_arguments?, #first_argument?, #parse_these_commandline_arguments, #second_argument?, #set_commandline_arguments

Methods included from BaseModule::Colours

#all_html_colours, #lightgreen, #rev, #sdir, #sfancy, #sfile, #simp, #steelblue, #tomato

Constructor Details

#initialize(use_this_text = '', run_already = true, &block) ⇒ WebObject

#

initialize

Usage example:

Cyberweb::Objectified::HtmlTags::WebObject.new(i)
#


34
35
36
37
38
39
40
41
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 34

def initialize(
    use_this_text = '',
    run_already   = true,
    &block
  )
  reset
  run if run_already
end

Instance Method Details

#internal_testing_the_functionalityObject

#

internal_testing_the_functionality

The following method showcases how this can be used.

This is mostly an ad-hoc method for testing. At a later time it should be modified to make it more useful.

#


83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 83

def internal_testing_the_functionality
  # ======================================================================= #
  # @_ will be our return String that will be served.
  # ======================================================================= #
  @_ << doctype?
  # head = ::Cyberweb::Objectified::HtmlTags::Head.new
  head = oop_head
  head.use_utf
  head.title(@internal_hash[:title])
  head.description 'Oki dokie'
  # head.add 'Yo there'
  head.style 'body { color: tomato; }'
  head.pull_in_css_file 'default.css'
  @_ << head.to_s
  image1 = oop_image('/home/x/data/images/NJOY/Susanne_03.jpg')
  image1.lazy_loading
  body = oop_body(image1)
  body.p('Hey there')
  body.p('How do you do?')
  body.p('How do you do?','steelblue')
  body.div('This should be a div tag.')
  @_ << body.to_s
end

#resetObject

#

reset (reset tag)

#


46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 46

def reset
  # ======================================================================= #
  # === @_
  # ======================================================================= #
  @_ = ''.dup
  # ======================================================================= #
  # === @internal_hash
  # ======================================================================= #
  @internal_hash = {}
  # ======================================================================= #
  # === :title
  # ======================================================================= #
  @internal_hash[:title] = 'Generic title'
end

#runObject

#

run

#


110
111
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 110

def run
end

#set_title(i) ⇒ Object

#

set_title

#


64
65
66
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 64

def set_title(i)
  @internal_hash[:title] = i.to_s.dup
end

#to_strObject Also known as: to_s

#

to_str

#


71
72
73
# File 'lib/cyberweb/objectified/web_object/web_object.rb', line 71

def to_str
  @_.to_s
end