Sha256: a9c526da24ffdbabd7d6d2d9f37f481d48b2b38457bfec76d16c2d5260a39cec
Contents?: true
Size: 1.28 KB
Versions: 29
Compression:
Stored size: 1.28 KB
Contents
module RubyXL module FontConvenienceMethods # Funny enough, but presence of <i> without value (equivalent to `val == nul`) means "italic = true"! # Same is true for bold, strikethrough, etc def is_italic i && (i.val != false) end def is_bold b && (b.val != false) end def is_underlined u && (u.val != false) end def is_strikethrough strike && (strike.val != false) end def get_name name && name.val end def get_size sz && sz.val end def get_rgb_color color && color.rgb end def set_italic(val) self.i = RubyXL::BooleanValue.new(:val => val) end def set_bold(val) self.b = RubyXL::BooleanValue.new(:val => val) end def set_underline(val) self.u = RubyXL::BooleanValue.new(:val => val) end def set_strikethrough(val) self.strike = RubyXL::BooleanValue.new(:val => val) end def set_name(val) self.name = RubyXL::StringValue.new(:val => val) end def set_size(val) self.sz = RubyXL::FloatValue.new(:val => val) end def set_rgb_color(font_color) self.color = RubyXL::Color.new(:rgb => font_color.to_s) end end RubyXL::Font.send(:include, RubyXL::FontConvenienceMethods) # ruby 2.1 compat end
Version data entries
29 entries across 29 versions & 1 rubygems