Class: Arrolio::Content::ParagraphBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/arrolio/content/builder.rb

Instance Method Summary collapse

Constructor Details

#initializeParagraphBuilder

Returns a new instance of ParagraphBuilder.



81
82
83
# File 'lib/arrolio/content/builder.rb', line 81

def initialize
  @runs = []
end

Instance Method Details

#em(str) ⇒ Object



93
94
95
# File 'lib/arrolio/content/builder.rb', line 93

def em(str)
  @runs << InlineRun.new(str.to_s, style_id: :em)
end


97
98
99
# File 'lib/arrolio/content/builder.rb', line 97

def link(str, href)
  @runs << InlineRun.new(str.to_s, style_id: :link, href: href)
end

#runs {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



101
102
103
104
105
# File 'lib/arrolio/content/builder.rb', line 101

def runs
  return @runs unless block_given?
  yield self
  @runs
end

#strong(str) ⇒ Object



89
90
91
# File 'lib/arrolio/content/builder.rb', line 89

def strong(str)
  @runs << InlineRun.new(str.to_s, style_id: :strong)
end

#text(str, style_id: :inline) ⇒ Object



85
86
87
# File 'lib/arrolio/content/builder.rb', line 85

def text(str, style_id: :inline)
  @runs << InlineRun.new(str.to_s, style_id: style_id)
end