Module: RubyXL::FontConvenienceMethods

Included in:
Font
Defined in:
lib/rubyXL/convenience_methods.rb

Instance Method Summary collapse

Instance Method Details

#get_nameObject



1106
1107
1108
# File 'lib/rubyXL/convenience_methods.rb', line 1106

def get_name
  name && name.val
end

#get_rgb_colorObject



1114
1115
1116
# File 'lib/rubyXL/convenience_methods.rb', line 1114

def get_rgb_color
  color && color.rgb
end

#get_sizeObject



1110
1111
1112
# File 'lib/rubyXL/convenience_methods.rb', line 1110

def get_size
  sz && sz.val
end

#is_boldObject



1094
1095
1096
# File 'lib/rubyXL/convenience_methods.rb', line 1094

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



1090
1091
1092
# File 'lib/rubyXL/convenience_methods.rb', line 1090

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

#is_strikethroughObject



1102
1103
1104
# File 'lib/rubyXL/convenience_methods.rb', line 1102

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

#is_underlinedObject



1098
1099
1100
# File 'lib/rubyXL/convenience_methods.rb', line 1098

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

#set_bold(val) ⇒ Object



1122
1123
1124
# File 'lib/rubyXL/convenience_methods.rb', line 1122

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

#set_italic(val) ⇒ Object



1118
1119
1120
# File 'lib/rubyXL/convenience_methods.rb', line 1118

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

#set_name(val) ⇒ Object



1134
1135
1136
# File 'lib/rubyXL/convenience_methods.rb', line 1134

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

#set_rgb_color(font_color) ⇒ Object



1142
1143
1144
# File 'lib/rubyXL/convenience_methods.rb', line 1142

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

#set_size(val) ⇒ Object



1138
1139
1140
# File 'lib/rubyXL/convenience_methods.rb', line 1138

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

#set_strikethrough(val) ⇒ Object



1130
1131
1132
# File 'lib/rubyXL/convenience_methods.rb', line 1130

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

#set_underline(val) ⇒ Object



1126
1127
1128
# File 'lib/rubyXL/convenience_methods.rb', line 1126

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