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
- #generate(&block) ⇒ Object
- #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
- #page_break(break_num = 1) ⇒ 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.
13 14 15 16 17 18 19 |
# File 'lib/rubyword/element/section.rb', line 13 def initialize(section_count, style = nil, rubyword=nil) @section_id = section_count @style = style @rubyword = rubyword @section_objects = [] @objects = [] end |
Instance Attribute Details
#objects ⇒ Object
Returns the value of attribute objects.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def objects @objects end |
#rubyword ⇒ Object
Returns the value of attribute rubyword.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def rubyword @rubyword end |
#section_id ⇒ Object
Returns the value of attribute section_id.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def section_id @section_id end |
#section_objects ⇒ Object
Returns the value of attribute section_objects.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def section_objects @section_objects end |
#style ⇒ Object
Returns the value of attribute style.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def style @style end |
#titles ⇒ Object
Returns the value of attribute titles.
12 13 14 |
# File 'lib/rubyword/element/section.rb', line 12 def titles @titles end |
Instance Method Details
#generate(&block) ⇒ Object
21 22 23 |
# File 'lib/rubyword/element/section.rb', line 21 def generate(&block) !block.nil? && block.arity < 1 ? instance_eval(&block) : block[self] end |
#image(url) ⇒ Object
41 42 43 44 45 |
# File 'lib/rubyword/element/section.rb', line 41 def image(url) object ||= Image.new(@rubyword) object.save(url) @objects << object end |
#link(text, link, style = nil) ⇒ Object
47 48 49 50 51 |
# File 'lib/rubyword/element/section.rb', line 47 def link(text, link, style=nil) object ||= Link.new(@rubyword) object.save(text, link, style) @objects << object end |
#list(text, level, style = nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/rubyword/element/section.rb', line 35 def list(text, level, style=nil) object ||= List.new(@rubyword) object.save(text, level, style) @objects << object end |
#page_break(break_num = 1) ⇒ Object
53 54 55 56 57 |
# File 'lib/rubyword/element/section.rb', line 53 def page_break(break_num=1) object ||= PageBreak.new(@rubyword) object.save(break_num) @objects << object end |
#text(text, style = nil) ⇒ Object Also known as: title_1, title_2, title_3, title_4
25 26 27 28 29 |
# File 'lib/rubyword/element/section.rb', line 25 def text(text, style=nil) object ||= Text.new(@rubyword, self) object.save(text, __callee__.to_s, style) @objects << object end |
#text_break(break_num = 1) ⇒ Object
59 60 61 62 63 |
# File 'lib/rubyword/element/section.rb', line 59 def text_break(break_num=1) object ||= TextBreak.new(@rubyword) object.save(break_num) @objects << object end |