lib/rtf/node.rb
def apply(style)
         # Check the input style.
         if !style.is_character_style?
            RTFError.fire("Non-character style specified to the "\
                          "CommandNode#apply() method.")
         end

         # Store fonts and colours.
         root.colours << style.foreground unless style.foreground.nil?
         root.colours << style.background unless style.background.nil?
         root.fonts << style.font unless style.font.nil?

         # Generate the command node.
         node = CommandNode.new(self, style.prefix(root.fonts, root.colours))
         yield node if block_given?
         self.store(node)
      end
def apply(style)
         # Check the input style.
         if !style.is_character_style?
            RTFError.fire("Non-character style specified to the "\
                          "CommandNode#apply() method.")
         end

         # Store fonts and colours.
         root.colours << style.foreground unless style.foreground.nil?
         root.colours << style.background unless style.background.nil?
         root.fonts << style.font unless style.font.nil?

         # Generate the command node.
         node = CommandNode.new(self, style.prefix(root.fonts, root.colours))
         yield node if block_given?
         self.store(node)
      end
def apply ( style ) # Check the input style. if ! style . is_character_style? RTFError . fire ( "Non-character style specified to the " "CommandNode#apply() method." ) end # Store fonts and colours. root . colours << style . foreground unless style . foreground . nil? root . colours << style . background unless style . background . nil? root . fonts << style . font unless style . font . nil? # Generate the command node. node = CommandNode . new ( self , style . prefix ( root . fonts , root . colours ) ) yield node if block_given? self . store ( node ) end
This method provides a short cut means for applying multiple styles via
 single command node. The method accepts a block that will be passed a
 reference to the node created. Once the block is complete the new node
 will be append as the last child of the CommandNode the method is called
 on.

 ==== Parameters
 style::  A reference to a CharacterStyle object that contains the style
          settings to be applied.

 ==== Exceptions
 RTFError::  Generated whenever a non-character style is specified to
             the method.
This method provides a short cut means for applying multiple styles via single command node . The method accepts a block that will be passed a reference to the node created . Once the block is complete the new node will be append as the last child of the CommandNode the method is called on .