Class: ClayText::Paragraph
- Inherits:
-
Object
- Object
- ClayText::Paragraph
- Defined in:
- lib/clayoven/claytext.rb
Overview
A paragraph of text
:content contains its content :fist asserts whether it’s the first paragraph in the body :type can be one of PARAGRAPH_TYPES
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#first ⇒ Object
Returns the value of attribute first.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(content) ⇒ Paragraph
constructor
A new instance of Paragraph.
- #is_first? ⇒ Boolean
Constructor Details
#initialize(content) ⇒ Paragraph
Returns a new instance of Paragraph.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/clayoven/claytext.rb', line 49 def initialize(content) @content = content @first = false @type = :plain # Generate is_*? methods for PARAGRAPH_TYPES Paragraph.class_eval do ClayText::PARAGRAPH_TYPES.each do |type| define_method("is_#{type.to_s}?") { @type == type } end end end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
47 48 49 |
# File 'lib/clayoven/claytext.rb', line 47 def content @content end |
#first ⇒ Object
Returns the value of attribute first.
47 48 49 |
# File 'lib/clayoven/claytext.rb', line 47 def first @first end |
#type ⇒ Object
Returns the value of attribute type.
47 48 49 |
# File 'lib/clayoven/claytext.rb', line 47 def type @type end |
Instance Method Details
#is_first? ⇒ Boolean
62 63 64 |
# File 'lib/clayoven/claytext.rb', line 62 def is_first? @first end |