Class: Pdf::Label::GlabelsTemplate

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/pdf/label/glabel_template.rb

Instance Method Summary collapse

Instance Method Details

#find_all_templatesObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pdf/label/glabel_template.rb', line 9

def find_all_templates
  return @t unless @t.nil?
  @t = []
  templates.each {|t|
    @t << "#{t[1].name}"
    t[1].alias.each {|a|
      @t << "#{a[1].name}"
    }
  }
  return @t
end

#find_template(t_name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pdf/label/glabel_template.rb', line 22

def find_template(t_name)
  return find_all_with_templates if t_name == :all
  if t = templates[t_name]
    return t
  else
    templates.each { |t|
      if t[1].alias[t_name]
        return t[1]
      end
    }
  end
  return nil
end