Class: Parchment::Style
- Inherits:
-
Object
- Object
- Parchment::Style
- Defined in:
- lib/parchment/style.rb
Direct Known Subclasses
Constant Summary collapse
- AVAILABLE_FORMATTING =
%w( bold italic underline aligned_left aligned_right aligned_center )
Instance Attribute Summary collapse
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#font_size ⇒ Object
readonly
Returns the value of attribute font_size.
-
#font_style ⇒ Object
readonly
Returns the value of attribute font_style.
-
#font_weight ⇒ Object
readonly
Returns the value of attribute font_weight.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_style_name ⇒ Object
readonly
Returns the value of attribute parent_style_name.
-
#text_align ⇒ Object
readonly
Returns the value of attribute text_align.
-
#text_underline_style ⇒ Object
readonly
Returns the value of attribute text_underline_style.
Instance Method Summary collapse
- #aligned_center? ⇒ Boolean
- #aligned_left? ⇒ Boolean
- #aligned_right? ⇒ Boolean
- #bold? ⇒ Boolean
-
#initialize(node) ⇒ Style
constructor
This needs to be defined in each format’s subclass.
- #italic? ⇒ Boolean
- #paragraph? ⇒ Boolean
- #text? ⇒ Boolean
- #underline? ⇒ Boolean
Constructor Details
#initialize(node) ⇒ Style
This needs to be defined in each format’s subclass.
25 26 27 |
# File 'lib/parchment/style.rb', line 25 def initialize(node) raise MissingFormatterMethodError end |
Instance Attribute Details
#family ⇒ Object (readonly)
Returns the value of attribute family.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def family @family end |
#font_size ⇒ Object (readonly)
Returns the value of attribute font_size.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def font_size @font_size end |
#font_style ⇒ Object (readonly)
Returns the value of attribute font_style.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def font_style @font_style end |
#font_weight ⇒ Object (readonly)
Returns the value of attribute font_weight.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def font_weight @font_weight end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def name @name end |
#parent_style_name ⇒ Object (readonly)
Returns the value of attribute parent_style_name.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def parent_style_name @parent_style_name end |
#text_align ⇒ Object (readonly)
Returns the value of attribute text_align.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def text_align @text_align end |
#text_underline_style ⇒ Object (readonly)
Returns the value of attribute text_underline_style.
13 14 15 |
# File 'lib/parchment/style.rb', line 13 def text_underline_style @text_underline_style end |
Instance Method Details
#aligned_center? ⇒ Boolean
57 58 59 |
# File 'lib/parchment/style.rb', line 57 def aligned_center? @text_align == :center end |
#aligned_left? ⇒ Boolean
49 50 51 |
# File 'lib/parchment/style.rb', line 49 def aligned_left? [:left, nil].include?(@text_align) end |
#aligned_right? ⇒ Boolean
53 54 55 |
# File 'lib/parchment/style.rb', line 53 def aligned_right? @text_align == :right end |
#bold? ⇒ Boolean
37 38 39 |
# File 'lib/parchment/style.rb', line 37 def bold? @font_weight == 'bold' end |
#italic? ⇒ Boolean
41 42 43 |
# File 'lib/parchment/style.rb', line 41 def italic? @font_style == 'italic' end |
#paragraph? ⇒ Boolean
29 30 31 |
# File 'lib/parchment/style.rb', line 29 def paragraph? @family == 'paragraph' end |
#text? ⇒ Boolean
33 34 35 |
# File 'lib/parchment/style.rb', line 33 def text? @family == 'text' end |
#underline? ⇒ Boolean
45 46 47 |
# File 'lib/parchment/style.rb', line 45 def underline? !@text_underline_style.nil? end |