Class: Cyberweb::Cybersprawl::SimpleForum
- Defined in:
- lib/cyberweb/webmin/simple_forum/simple_forum.rb
Overview
Cyberweb::Cybersprawl::SimpleForum
Constant Summary
Constants inherited from Base
Base::HOME_DIRECTORY_OF_THE_USER_X, Base::NAMESPACE
Class Method Summary collapse
-
.[](i = ARGV) ⇒ Object
# === Cyberweb::Cybersprawl::SimpleForum[] ========================================================================= #.
Instance Method Summary collapse
-
#available_topics? ⇒ Boolean
# === available_topics? ========================================================================= #.
-
#current_id? ⇒ Boolean
# === current_id? ========================================================================= #.
-
#increment_by_one(i) ⇒ Object
# === increment_by_one ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ SimpleForum
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#store_note(what = "Hello world!\n", into = current_id? ) ⇒ Object
# === store_note.
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(commandline_arguments = nil, run_already = true) ⇒ SimpleForum
#
initialize
#
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 25 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
Instance Method Details
#available_topics? ⇒ Boolean
#
available_topics?
#
66 67 68 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 66 def available_topics? @internal_hash[:available_topics] end |
#current_id? ⇒ Boolean
#
current_id?
#
59 60 61 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 59 def current_id? @internal_hash[:current_id] end |
#increment_by_one(i) ⇒ Object
#
increment_by_one
#
110 111 112 113 114 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 110 def increment_by_one(i) i =~ /(\d{1,2})/ old_number = $1.to_s.dup.to_i return (old_number.to_i + 1).to_s+'.yml' end |
#reset ⇒ Object
#
reset (reset tag)
#
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 39 def reset super() infer_the_namespace create_the_internal_hash # ======================================================================= # # === :available_topics # ======================================================================= # @internal_hash[:available_topics] = [] # ======================================================================= # # === :current_id # # This is the ID of the message that is to be stored. # ======================================================================= # @internal_hash[:current_id] = 1 set_be_verbose end |
#run ⇒ Object
#
run (run tag)
#
119 120 |
# File 'lib/cyberweb/webmin/simple_forum/simple_forum.rb', line 119 def run end |
#store_note(what = "Hello world!\n", into = current_id? ) ⇒ Object
#
store_note
This is the method that can be used to store content into a local .yml file.
#
76 77 78 79 80 81 82 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/webmin/simple_forum/simple_forum.rb', line 76 def store_note( what = "Hello world!\n", into = current_id? ) into = into.to_s.dup unless into.end_with? '.yml' into << '.yml' end # ======================================================================= # # The next clause will automatically increment. # ======================================================================= # if File.exist? into loop { into = increment_by_one(into) break unless File.exist? into } end if be_verbose? puts 'Storing into the file `'+sfile(into)+'`.' end = :user_123 hash = { author: , content: what } write_what_into( YAML.dump(hash), into ) end |