Class: Rabbit::Element::Table

Inherits:
Object
  • Object
show all
Includes:
BlockElement, ContainerElement
Defined in:
lib/rabbit/element/table.rb

Constant Summary

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Attributes included from ContainerElement

#elements

Attributes included from Base

#base_h, #base_w, #base_x, #base_y, #default_margin_bottom, #default_margin_left, #default_margin_right, #default_margin_top, #default_padding_bottom, #default_padding_left, #default_padding_right, #default_padding_top, #default_visible, #h, #horizontal_centering, #margin_bottom, #margin_left, #margin_right, #margin_top, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #ph, #pw, #px, #py, #real_simulation, #user_property, #vertical_centering, #w, #x, #y

Instance Method Summary collapse

Methods included from BlockElement

#adjust_y_padding, #inline_element?

Methods included from ContainerElement

#<<, #[], #[]=, #_width, #clear_theme, #compile, #compile_elements, #compile_horizontal, #compile_horizontal_element, #delete, #dirty?, #draw_element, #draw_elements, #have_tag?, #have_wait_tag?, #height, #inspect, #prop_delete, #prop_get, #prop_set, #replace_element, #substitute_text, #unshift, #width

Methods included from Base

#[], #[]=, #add_default_prop, #adjust_x_centering, #adjust_y_margin, #adjust_y_padding, #available_w, #centering_adjusted_height, #centering_adjusted_width, #clear_margin, #clear_padding, #clear_theme, #clone, #compile, #compile_element, #compile_for_horizontal_centering, #compile_horizontal, #default_prop, #dirty!, #dirty?, #do_horizontal_centering, #do_horizontal_centering?, #do_vertical_centering?, #draw, #font, #have_tag?, #have_wait_tag?, #height, #hide, #if_dirty, #init_default_margin, #init_default_padding, #init_default_visible, #inline_element?, #inspect, #margin_set, #margin_with, #match?, #next_element, #padding_set, #padding_with, #previous_element, #prop_delete, #prop_get, #prop_set, #prop_value, #reset_horizontal_centering, #restore_x_margin, #restore_x_padding, #setup_margin, #setup_padding, #show, #slide, #substitute_newline, #substitute_text, #text_renderer?, #visible?, #wait, #width

Methods included from Base::DrawHook

#clear_draw_procs, def_draw_hook, def_draw_hooks

Methods included from Utils

arg_list, collect_classes_under_module, collect_modules_under_module, collect_under_module, combination, compute_bottom_y, compute_left_x, compute_right_x, compute_top_y, corresponding_class_under_module, corresponding_module_under_module, corresponding_objects, ensure_time, events_pending_available?, extract_four_way, find_path_in_load_path, init_by_constants_as_default_value, move_to, move_to_bottom_left, move_to_bottom_right, move_to_top_left, move_to_top_right, parse_four_way, process_pending_events, process_pending_events_proc, quartz?, require_files_under_directory_in_load_path, require_safe, split_number_to_minute_and_second, stringify_hash_key, support_console_input?, support_console_output?, syntax_highlighting_debug?, time, to_class_name, unescape_title, windows?

Methods included from GetText

included

Constructor Details

#initialize(prop = {}) ⇒ Table

Returns a new instance of Table.



12
13
14
15
16
17
# File 'lib/rabbit/element/table.rb', line 12

def initialize(prop={})
  super()
  %w(caption).each do |name|
    instance_variable_set("@#{name}", prop[name])
  end
end

Instance Attribute Details

#captionObject (readonly)

Returns the value of attribute caption.



11
12
13
# File 'lib/rabbit/element/table.rb', line 11

def caption
  @caption
end

Instance Method Details

#bodyObject



23
24
25
# File 'lib/rabbit/element/table.rb', line 23

def body
  elements.find {|e| e.is_a?(TableBody)}
end

#container_textObject



27
# File 'lib/rabbit/element/table.rb', line 27

alias container_text text

#headObject



19
20
21
# File 'lib/rabbit/element/table.rb', line 19

def head
  elements.find {|e| e.is_a?(TableHead)}
end

#textObject



28
29
30
31
32
33
# File 'lib/rabbit/element/table.rb', line 28

def text
  result = ''
  result << "#{@caption}\n" if @caption
  result << super
  result
end

#to_html(generator) ⇒ Object



43
44
45
46
47
# File 'lib/rabbit/element/table.rb', line 43

def to_html(generator)
  caption = nil
  caption = "<caption>#{@caption}</caption>\n" if @caption
  "<table>\n#{caption}#{super}\n</table>"
end

#to_rdObject



35
36
37
38
39
40
41
# File 'lib/rabbit/element/table.rb', line 35

def to_rd
  result = "# RT\n"
  result << "caption = #{@caption}\n" if @caption
  result << "\n"
  result << container_text
  result.gsub(/^/, "  ")
end