Class: Prawn::SVG::Elements::Switch

Inherits:
Base
  • Object
show all
Defined in:
lib/prawn/svg/elements/switch.rb

Constant Summary collapse

FEATURE_PREFIX =
'http://www.w3.org/TR/SVG11/feature#'.freeze
SUPPORTED_FEATURES =
Set.new(
  %w[
    SVG
    SVG-static
    CoreAttribute
    Structure
    BasicStructure
    ConditionalProcessing
    Image
    Style
    Shape
    Text
    BasicText
    PaintAttribute
    BasicPaintAttribute
    OpacityAttribute
    BasicGraphicsAttribute
    Marker
    Gradient
    Pattern
    Clip
    BasicClip
    Mask
    Hyperlinking
    XlinkAttribute
  ].map { |name| "#{FEATURE_PREFIX}#{name}" }
).freeze

Constants inherited from Base

Base::COMMA_WSP_REGEXP, Base::MissingAttributesError, Base::PAINT_TYPES, Base::SVG_NAMESPACE, Base::SkipElementError, Base::SkipElementQuietly

Constants included from Attributes::Stroke

Attributes::Stroke::CAP_STYLE_TRANSLATIONS, Attributes::Stroke::JOIN_STYLE_TRANSLATIONS

Instance Attribute Summary

Attributes inherited from Base

#attributes, #base_calls, #calls, #document, #parent_calls, #properties, #source, #state

Instance Method Summary collapse

Methods inherited from Base

#initialize, #name, #parse_and_apply, #process

Methods included from TransformParser

#parse_transform_attribute

Methods included from PDFMatrix

#load_matrix, #matrix_for_pdf, #rotation_matrix, #scale_matrix, #translation_matrix

Methods included from Attributes::Space

#parse_xml_space_attribute

Methods included from Attributes::Stroke

#parse_stroke_attributes_and_call

Methods included from Attributes::Mask

#parse_mask_attribute_and_call

Methods included from Attributes::ClipPath

#parse_clip_path_attribute_and_call

Methods included from Attributes::Opacity

#parse_opacity_attributes_and_call

Methods included from Attributes::Transform

#parse_transform_attribute_and_call

Constructor Details

This class inherits a constructor from Prawn::SVG::Elements::Base

Instance Method Details

#container?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/prawn/svg/elements/switch.rb', line 32

def container?
  true
end

#process_child_elementsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/prawn/svg/elements/switch.rb', line 36

def process_child_elements
  return unless source

  elem = svg_child_elements.find do |e|
    passes_conditional_processing?(e) && Prawn::SVG::Elements::TAG_CLASS_MAPPING[e.name.to_sym]
  end

  return unless elem

  element_class = Prawn::SVG::Elements::TAG_CLASS_MAPPING[elem.name.to_sym]
  add_call 'save'
  child = element_class.new(@document, elem, @calls, state.dup)
  child.process
  add_call 'restore'
end