Module: RubyXL::FontConvenienceMethods

Defined in:
lib/rubyXL/convenience_methods/font.rb

Instance Method Summary collapse

Instance Method Details

#get_nameObject



21
22
23
# File 'lib/rubyXL/convenience_methods/font.rb', line 21

def get_name
  name && name.val
end

#get_rgb_colorObject



29
30
31
# File 'lib/rubyXL/convenience_methods/font.rb', line 29

def get_rgb_color
  color && color.rgb
end

#get_sizeObject



25
26
27
# File 'lib/rubyXL/convenience_methods/font.rb', line 25

def get_size
  sz && sz.val
end

#is_boldObject



9
10
11
# File 'lib/rubyXL/convenience_methods/font.rb', line 9

def is_bold
  b && (b.val != false)
end

#is_italicObject

Funny enough, but presence of <i> without value (equivalent to ‘val == nul`) means “italic = true”! Same is true for bold, strikethrough, etc



5
6
7
# File 'lib/rubyXL/convenience_methods/font.rb', line 5

def is_italic
  i && (i.val != false)
end

#is_strikethroughObject



17
18
19
# File 'lib/rubyXL/convenience_methods/font.rb', line 17

def is_strikethrough
  strike && (strike.val != false)
end

#is_underlinedObject



13
14
15
# File 'lib/rubyXL/convenience_methods/font.rb', line 13

def is_underlined
  u && (u.val != false)
end

#set_bold(val) ⇒ Object



37
38
39
# File 'lib/rubyXL/convenience_methods/font.rb', line 37

def set_bold(val)
  self.b = RubyXL::BooleanValue.new(:val => val)
end

#set_italic(val) ⇒ Object



33
34
35
# File 'lib/rubyXL/convenience_methods/font.rb', line 33

def set_italic(val)
  self.i = RubyXL::BooleanValue.new(:val => val)
end

#set_name(val) ⇒ Object



49
50
51
# File 'lib/rubyXL/convenience_methods/font.rb', line 49

def set_name(val)
  self.name = RubyXL::StringValue.new(:val => val)
end

#set_rgb_color(font_color) ⇒ Object



57
58
59
# File 'lib/rubyXL/convenience_methods/font.rb', line 57

def set_rgb_color(font_color)
  self.color = RubyXL::Color.new(:rgb => font_color.to_s)
end

#set_size(val) ⇒ Object



53
54
55
# File 'lib/rubyXL/convenience_methods/font.rb', line 53

def set_size(val)
  self.sz = RubyXL::FloatValue.new(:val => val)
end

#set_strikethrough(val) ⇒ Object



45
46
47
# File 'lib/rubyXL/convenience_methods/font.rb', line 45

def set_strikethrough(val)
  self.strike = RubyXL::BooleanValue.new(:val => val)
end

#set_underline(val) ⇒ Object



41
42
43
# File 'lib/rubyXL/convenience_methods/font.rb', line 41

def set_underline(val)
  self.u = RubyXL::BooleanValue.new(:val => val)
end