Class: Lablr::Template

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

Overview

templates define label layout(with erb) and rendering

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Template

Returns a new instance of Template.



14
15
16
17
18
19
20
# File 'lib/lablr.rb', line 14

def initialize(options = {})
  @erb = options[:erb]          ||= nil
  @name = options[:name]        ||= nil
  @content = options[:content]  ||= "No Content Set"
  @style = options[:style]      ||= TemplateStyle.new
  @erb = ERB.new(File.read(File.join(Lablr.GEM_ROOT, "assets", "templates",  "_" + @name.to_s + ".erb")))
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



10
11
12
# File 'lib/lablr.rb', line 10

def content
  @content
end

#erbObject

Returns the value of attribute erb.



10
11
12
# File 'lib/lablr.rb', line 10

def erb
  @erb
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/lablr.rb', line 10

def name
  @name
end

#styleObject

Returns the value of attribute style.



10
11
12
# File 'lib/lablr.rb', line 10

def style
  @style
end

Instance Method Details

#getBindingObject

make binding accessible to pass into erb



22
23
24
# File 'lib/lablr.rb', line 22

def getBinding # make binding accessible to pass into erb
  return binding()
end