Class: SVGPlot::ChildTag

Inherits:
Tag
  • Object
show all
Defined in:
lib/svgplot/tag.rb

Overview

Child tag, used for tags within another tag

Direct Known Subclasses

Gradient, Path, Plot, Raw

Instance Attribute Summary collapse

Attributes inherited from Tag

#attributes, #children, #defaults, #tag

Instance Method Summary collapse

Methods inherited from Tag

#append_child, #method_missing, #path, #raw, #respond_to?, #spawn_child, #to_s, #use, #write

Methods included from Expansion

#expand

Methods included from Transform

#matrix, #rotate, #scale, #skew_x, #skew_y, #translate

Constructor Details

#initialize(img, tag, params = {}, &block) ⇒ ChildTag

Returns a new instance of ChildTag.



95
96
97
98
# File 'lib/svgplot/tag.rb', line 95

def initialize(img, tag, params = {}, &block)
  @img = img
  super(tag, params, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SVGPlot::Tag

Instance Attribute Details

#imgObject (readonly)

Returns the value of attribute img.



93
94
95
# File 'lib/svgplot/tag.rb', line 93

def img
  @img
end

Instance Method Details

#linear_gradient(id, attributes = {}, if_exists = :skip, &block) ⇒ Object



100
101
102
# File 'lib/svgplot/tag.rb', line 100

def linear_gradient(id, attributes = {}, if_exists = :skip, &block)
  @img.add_def(id, LinearGradient.new(@img, attributes), if_exists, &block)
end

#radial_gradient(id, attributes = {}, if_exists = :skip, &block) ⇒ Object



104
105
106
# File 'lib/svgplot/tag.rb', line 104

def radial_gradient(id, attributes = {}, if_exists = :skip, &block)
  @img.add_def(id, RadialGradient.new(@img, attributes), if_exists, &block)
end