Class: Prune::Fonts::Base
- Inherits:
-
Object
- Object
- Prune::Fonts::Base
- Defined in:
- lib/prune/fonts/base.rb
Instance Attribute Summary collapse
-
#font_name ⇒ Object
readonly
Returns the value of attribute font_name.
Class Method Summary collapse
-
.bold?(options) ⇒ Boolean
Check bold flag.
-
.font_name ⇒ Object
Get font name.
-
.italic?(options) ⇒ Boolean
Check italic flag.
Instance Method Summary collapse
-
#encoding ⇒ Object
Get encoding of the font.
-
#font_sym ⇒ Object
Get font symbol.
-
#initialize(document) ⇒ Base
constructor
Initialize.
-
#name ⇒ Object
Get name of the font.
-
#reference ⇒ Object
Get reference of the font.
Methods included from PObjects
Constructor Details
#initialize(document) ⇒ Base
Initialize.
35 36 37 38 39 |
# File 'lib/prune/fonts/base.rb', line 35 def initialize(document) @document = document @main_element = nil @font_name = self.class.font_name end |
Instance Attribute Details
#font_name ⇒ Object (readonly)
Returns the value of attribute font_name.
32 33 34 |
# File 'lib/prune/fonts/base.rb', line 32 def font_name @font_name end |
Class Method Details
.bold?(options) ⇒ Boolean
Check bold flag.
12 13 14 15 16 |
# File 'lib/prune/fonts/base.rb', line 12 def bold?() raise FontOptionError unless [true, false, nil].include?([:bold]) [:bold] || false end |
.font_name ⇒ Object
Get font name.
26 27 28 29 |
# File 'lib/prune/fonts/base.rb', line 26 def font_name class_name = self.to_s.gsub(/\A.*::/, "") class_name.gsub(/\A(.)/){$1.downcase}.gsub(/([A-Z])/){"_#{$1.downcase}"} end |
.italic?(options) ⇒ Boolean
Check italic flag.
19 20 21 22 23 |
# File 'lib/prune/fonts/base.rb', line 19 def italic?() raise FontOptionError unless [true, false, nil].include?([:italic]) [:italic] || false end |
Instance Method Details
#encoding ⇒ Object
Get encoding of the font.
52 53 54 |
# File 'lib/prune/fonts/base.rb', line 52 def encoding @main_element.encoding end |
#font_sym ⇒ Object
Get font symbol.
57 58 59 |
# File 'lib/prune/fonts/base.rb', line 57 def font_sym @font_name.to_sym end |
#name ⇒ Object
Get name of the font.
47 48 49 |
# File 'lib/prune/fonts/base.rb', line 47 def name @main_element.name end |
#reference ⇒ Object
Get reference of the font.
42 43 44 |
# File 'lib/prune/fonts/base.rb', line 42 def reference @main_element.reference end |