Class: DefaultAvatarGenerator::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/default_avatar_generator/layer.rb

Overview

The Layer class is responsible for rendering SVG templates with given parameters.

Direct Known Subclasses

BackgroundLayer, ForegroundLayer, TextLayer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_name, params = {}) ⇒ Layer



10
11
12
13
# File 'lib/default_avatar_generator/layer.rb', line 10

def initialize(template_name, params = {})
  @template_name = template_name
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/default_avatar_generator/layer.rb', line 8

def params
  @params
end

#template_nameObject (readonly)

Returns the value of attribute template_name.



8
9
10
# File 'lib/default_avatar_generator/layer.rb', line 8

def template_name
  @template_name
end

Instance Method Details

#renderObject



15
16
17
18
# File 'lib/default_avatar_generator/layer.rb', line 15

def render
  template = load_template
  process_template(template)
end