Module: Cyberweb::Objectified::ShorterHelperMethods

Defined in:
lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb

Overview

Cyberweb::Objectified::ShorterHelperMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.alias_towards_the_registered_html_tagsObject

#

Cyberweb::Objectified::ShorterHelperMethods.alias_towards_the_registered_html_tags

This method will alias methods such as “h1” towards “oop_h1”. The idea here is that we can simply make use of h1, h2 and so forth tags directly, and point them towards the corresponding oop_ method.

The method used to be a small module, achieving compatibility towards HTML tags, but in July 2023 it was integrated into this module instead, and made a method.

#


452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 452

def self.alias_towards_the_registered_html_tags
  require 'html_tags/array_registered_html_tags.rb'
  # ======================================================================= #
  # Batch-alias all known HTML tags next:
  # ======================================================================= #
  ::HtmlTags::ARRAY_REGISTERED_HTML_TAGS.each {|this_html_tag|
    target_this_method = ('oop_'+this_html_tag).to_sym
    if Cyberweb::Objectified::ShorterHelperMethods.respond_to?(target_this_method)
      self.class_eval {
        # ================================================================= #
        # For instance: div -> oop_div
        # ================================================================= #
        alias_method(this_html_tag.to_sym, target_this_method)
      }
    else
      # puts 'Debug-information: The method :'+target_this_method.to_s+
      #      ' is NOT registered.'
    end
  }
end

Instance Method Details

#html_a(i = ARGV) ⇒ Object Also known as: oop_a

#

html_a (a tag)

#


228
229
230
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 228

def html_a(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::A.new(i)
end

#html_abbr(i = ARGV) ⇒ Object Also known as: oop_abbr

#

html_abbr

#


242
243
244
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 242

def html_abbr(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Abbr.new(i)
end

#html_audio(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_audio

#

html_audio

#


209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 209

def html_audio(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::Audio.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_blockquote(i = ARGV) ⇒ Object Also known as: oop_blockquote

#

html_blockquote

#


249
250
251
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 249

def html_blockquote(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Blockquote.new(i)
end

#html_body(i = '') ⇒ Object Also known as: oop_body

#

html_body

#


94
95
96
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 94

def html_body(i = '')
  return Cyberweb::Objectified::HtmlTags::Body.new(i)
end

#html_button(use_this_text = '', optional_css_class = Button.css_class?, optional_id = nil, optional_css_style = nil) ⇒ Object Also known as: oop_button

#

html_button

Usage example:

button1 = oop_button('Click me', id: 'test_button')
#


334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 334

def html_button(
    use_this_text      = '',
    optional_css_class = Button.css_class?,
    optional_id        = nil,
    optional_css_style = nil
  )
  return Cyberweb::Objectified::HtmlTags::Button.new(
    use_this_text,
    optional_css_class,
    optional_id,
    optional_css_style
  )
end

#html_canvas(i = ARGV) ⇒ Object Also known as: oop_canvas

#

html_canvas

#


322
323
324
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 322

def html_canvas(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Canvas.new(i)
end

#html_checkbox(i = ARGV) ⇒ Object

#

html_checkbox

#


385
386
387
388
389
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 385

def html_checkbox(i = ARGV)
  _ = Cyberweb::Objectified::HtmlTags::Input.new(i)
  _.is_a_checkbox # Enable that this is a checkbox.
  return _
end

#html_cite(i = '') ⇒ Object Also known as: oop_cite

#

html_cite

#


273
274
275
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 273

def html_cite(i = '')
  return Cyberweb::Objectified::HtmlTags::Cite.new(i)
end

#html_combobox(i = ARGV) ⇒ Object Also known as: html_dropbox, oop_combobox

#

html_combobox

You can pass an Array of options to the method.

#


360
361
362
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 360

def html_combobox(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Combobox.new(i)
end

#html_div(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_div

#

html_div

#


406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 406

def html_div(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::Div.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_embed(i = ARGV) ⇒ Object Also known as: oop_embed

#

html_embed

#


294
295
296
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 294

def html_embed(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Embed.new(i)
end

#html_fieldset(i = '') ⇒ Object Also known as: oop_fieldset

#

html_fieldset

#


351
352
353
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 351

def html_fieldset(i = '')
  return Cyberweb::Objectified::HtmlTags::Fieldset.new(i)
end

#html_figure(i = ARGV) ⇒ Object Also known as: oop_figure

#

html_figure

#


287
288
289
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 287

def html_figure(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Figure.new(i)
end

#html_form(i = ARGV) ⇒ Object Also known as: oop_form

#

html_form

#


256
257
258
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 256

def html_form(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Form.new(i)
end

#html_h1(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_h1

#

html_h1

#


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 101

def html_h1(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::H1.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_h2(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_h2

#

html_h2

#


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 120

def html_h2(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::H2.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_h3(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil) ⇒ Object Also known as: oop_h3

#

html_h3

#


139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 139

def html_h3(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil
  )
  return Cyberweb::Objectified::HtmlTags::H3.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style
  )
end

#html_h4(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil) ⇒ Object Also known as: oop_h4

#

html_h4

#


156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 156

def html_h4(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil
  )
  return Cyberweb::Objectified::HtmlTags::H4.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style
  )
end

#html_h5(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil) ⇒ Object Also known as: oop_h5

#

html_h5

#


173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 173

def html_h5(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil
  )
  return Cyberweb::Objectified::HtmlTags::H5.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style
  )
end

#html_h6(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_h6

#

html_h6

#


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 190

def html_h6(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::H6.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_head(i = ARGV) ⇒ Object Also known as: oop_head

#

html_head

This method will ultimately represent a HTML <head> tag.

#


370
371
372
373
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 370

def html_head(i = ARGV)
  i = i.join(' ').strip if i.is_a? Array
  return Cyberweb::Objectified::HtmlTags::Head.new(i)
end

#html_img(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: html_image, oop_image, oop_img

#

html_img

#


66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 66

def html_img(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::Img.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_input(use_this_text = ARGV, optional_css_class = Input.css_class?, optional_id = nil, optional_css_style = nil) ⇒ Object Also known as: entry, oop_input, oop_entry

#

html_input

The alias “entry” is derived from GUI toolkits such as gtk calling the user-input element Gtk::Entry.

#


32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 32

def html_input(
    use_this_text      = ARGV,
    optional_css_class = Input.css_class?,
    optional_id        = nil,
    optional_css_style = nil
  )
  _ = Cyberweb::Objectified::HtmlTags::Input.new(
    use_this_text,
    optional_css_class,
    optional_id,
    optional_css_style
  )
  return _
end

#html_meta(i = ARGV) ⇒ Object Also known as: oop_meta

#

html_meta

#


280
281
282
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 280

def html_meta(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Meta.new(i)
end

#html_object(i = ARGV) ⇒ Object Also known as: oop_object

#

html_object

#


378
379
380
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 378

def html_object(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Object.new(i)
end

#html_p(i = ARGV, optional_css_class = '') ⇒ Object Also known as: oop_p

#

html_p

#


263
264
265
266
267
268
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 263

def html_p(
    i                  = ARGV,
    optional_css_class = ''
  )
  return Cyberweb::Objectified::HtmlTags::P.new(i, optional_css_class)
end

#html_pre(i = ARGV) ⇒ Object Also known as: oop_pre

#

html_pre

#


308
309
310
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 308

def html_pre(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Pre.new(i)
end

#html_span(i = ARGV, optional_css_class = nil, optional_id = nil, optional_css_style = nil, &block) ⇒ Object Also known as: oop_span

#

html_span

#


425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 425

def html_span(
    i                  = ARGV,
    optional_css_class = nil,
    optional_id        = nil,
    optional_css_style = nil,
    &block
  )
  return Cyberweb::Objectified::HtmlTags::Span.new(
    i,
    optional_css_class,
    optional_id,
    optional_css_style,
    &block
  )
end

#html_style(i = '') ⇒ Object Also known as: oop_style

#

html_style

#


87
88
89
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 87

def html_style(i = '')
  return Cyberweb::Objectified::HtmlTags::Style.new(i)
end

#html_submit(i = ARGV) ⇒ Object Also known as: html_submit_button, submit_button, oop_submit

#

html_submit

#


395
396
397
398
399
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 395

def html_submit(i = ARGV)
  _ = Cyberweb::Objectified::HtmlTags::Input.new(i)
  _.is_a_submit_button
  return _
end

#html_table(i = ARGV) ⇒ Object Also known as: oop_table

#

html_table

#


301
302
303
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 301

def html_table(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Table.new(i)
end

#html_title(i = ARGV) ⇒ Object Also known as: oop_title

#

html_title

#


315
316
317
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 315

def html_title(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Title.new(i)
end

#html_ul(i = ARGV) ⇒ Object Also known as: oop_ul

#

html_ul

#


235
236
237
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 235

def html_ul(i = ARGV)
  return Cyberweb::Objectified::HtmlTags::Ul.new(i)
end

#last_tag?Boolean Also known as: last_tag

#

last_tag?

#

Returns:

  • (Boolean)


52
53
54
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 52

def last_tag?
  ::Cyberweb::Objectified::HtmlTags.last_tag?
end

#last_tags?Boolean Also known as: last_tags

#

last_tags?

#

Returns:

  • (Boolean)


59
60
61
# File 'lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb', line 59

def last_tags?
  ::Cyberweb::Objectified::HtmlTags.last_tags?
end