Class: Rubyword::Element::Section
- Inherits:
-
Object
- Object
- Rubyword::Element::Section
- Defined in:
- lib/rubyword/element/section.rb
Instance Attribute Summary collapse
-
#objects ⇒ Object
Returns the value of attribute objects.
-
#rubyword ⇒ Object
Returns the value of attribute rubyword.
-
#section_id ⇒ Object
Returns the value of attribute section_id.
-
#section_objects ⇒ Object
Returns the value of attribute section_objects.
-
#style ⇒ Object
Returns the value of attribute style.
-
#titles ⇒ Object
Returns the value of attribute titles.
Instance Method Summary collapse
- #image(url) ⇒ Object
-
#initialize(section_count, style = nil, rubyword = nil) ⇒ Section
constructor
A new instance of Section.
- #link(text, link, style = nil) ⇒ Object
- #list(text, level, style = nil) ⇒ Object
- #p(style = nil, &block) ⇒ Object
- #page_break(break_num = 1) ⇒ Object
- #table(style = nil, &block) ⇒ Object
- #text(text, style = nil) ⇒ Object (also: #title_1, #title_2, #title_3, #title_4)
- #text_break(break_num = 1) ⇒ Object
Constructor Details
#initialize(section_count, style = nil, rubyword = nil) ⇒ Section
Returns a new instance of Section.
15 16 17 18 19 20 21 22 |
# File 'lib/rubyword/element/section.rb', line 15 def initialize(section_count, style = nil, rubyword=nil) @section_id = section_count @style = style @rubyword = rubyword @section_objects = [] @objects = [] @text_blocks = [] end |
Instance Attribute Details
#objects ⇒ Object
Returns the value of attribute objects.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def objects @objects end |
#rubyword ⇒ Object
Returns the value of attribute rubyword.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def rubyword @rubyword end |
#section_id ⇒ Object
Returns the value of attribute section_id.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def section_id @section_id end |
#section_objects ⇒ Object
Returns the value of attribute section_objects.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def section_objects @section_objects end |
#style ⇒ Object
Returns the value of attribute style.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def style @style end |
#titles ⇒ Object
Returns the value of attribute titles.
13 14 15 |
# File 'lib/rubyword/element/section.rb', line 13 def titles @titles end |
Instance Method Details
#image(url) ⇒ Object
60 61 62 63 64 |
# File 'lib/rubyword/element/section.rb', line 60 def image(url) object ||= Image.new(@rubyword) object.save(url) @objects << object end |
#link(text, link, style = nil) ⇒ Object
54 55 56 57 58 |
# File 'lib/rubyword/element/section.rb', line 54 def link(text, link, style=nil) object ||= Link.new(@rubyword) object.save(text, link, style) @objects << object end |
#list(text, level, style = nil) ⇒ Object
48 49 50 51 52 |
# File 'lib/rubyword/element/section.rb', line 48 def list(text, level, style=nil) object ||= List.new(@rubyword) object.save(text, level, style) @objects << object end |
#p(style = nil, &block) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/rubyword/element/section.rb', line 24 def p(style=nil, &block) object ||= Paragraph.new(@rubyword, self, style) return nil unless block_given? object.instance_eval(&block) @objects << object end |
#page_break(break_num = 1) ⇒ Object
66 67 68 69 70 |
# File 'lib/rubyword/element/section.rb', line 66 def page_break(break_num=1) object ||= PageBreak.new(@rubyword) object.save(break_num) @objects << object end |
#table(style = nil, &block) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rubyword/element/section.rb', line 31 def table(style=nil, &block) object ||= Table.new(@rubyword, self, style) return nil unless block_given? object.instance_eval(&block) @objects << object end |