mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 12:16:06 +08:00
14 lines
375 B
Ruby
14 lines
375 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LabelTemplate < ApplicationRecord
|
|
enum language_type: { zpl: 0 }
|
|
validates :name, presence: true
|
|
validates :size, presence: true
|
|
validates :content, presence: true
|
|
|
|
def render(locals)
|
|
locals.reduce(content.dup) do |rendered_content, (key, value)|
|
|
rendered_content.gsub!(/\{\{#{key}\}\}/, value.to_s)
|
|
end
|
|
end
|
|
end
|