Class: Lablr::Template
- Inherits:
-
Object
- Object
- Lablr::Template
- Defined in:
- lib/lablr.rb
Overview
templates define label layout(with erb) and rendering
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#erb ⇒ Object
Returns the value of attribute erb.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
-
#getBinding ⇒ Object
make binding accessible to pass into erb.
-
#initialize(options = {}) ⇒ Template
constructor
A new instance of Template.
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( = {}) @erb = [:erb] ||= nil @name = [:name] ||= nil @content = [:content] ||= "No Content Set" @style = [:style] ||= TemplateStyle.new @erb = ERB.new(File.read(File.join(Lablr.GEM_ROOT, "assets", "templates", "_" + @name.to_s + ".erb"))) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
10 11 12 |
# File 'lib/lablr.rb', line 10 def content @content end |
#erb ⇒ Object
Returns the value of attribute erb.
10 11 12 |
# File 'lib/lablr.rb', line 10 def erb @erb end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/lablr.rb', line 10 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
10 11 12 |
# File 'lib/lablr.rb', line 10 def style @style end |
Instance Method Details
#getBinding ⇒ Object
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 |