Class: Lablr::Template::Base
- Inherits:
-
Object
- Object
- Lablr::Template::Base
- Defined in:
- lib/lablr/template.rb
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 = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lablr/template.rb', line 8 def initialize( = {}) #@erb = options[:erb] ||= nil [:name] ||= "avery_5163" [:content] ||= "No Content Set" [:style] ||= TemplateStyle.new @name = [:name] @content = [:content] @style = [:style] template_file = File.join(Lablr.GEM_ROOT, "assets", "templates", "_" + (@name.to_s) + ".erb") template_content = File.exists?(template_file) ? File.read(template_file) : "Template Not Found: #{template_file}" @erb = ::ERB.new(template_content) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/lablr/template.rb', line 4 def content @content end |
#erb ⇒ Object
Returns the value of attribute erb.
4 5 6 |
# File 'lib/lablr/template.rb', line 4 def erb @erb end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/lablr/template.rb', line 4 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
4 5 6 |
# File 'lib/lablr/template.rb', line 4 def style @style end |
Instance Method Details
#getBinding ⇒ Object
make binding accessible to pass into erb
24 25 26 |
# File 'lib/lablr/template.rb', line 24 def getBinding # make binding accessible to pass into erb return binding end |