Class: RenderTable::Base
- Inherits:
-
Object
- Object
- RenderTable::Base
- Includes:
- ERB::Util
- Defined in:
- lib/render_table/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#html ⇒ Object
Returns the value of attribute html.
-
#options ⇒ Object
Returns the value of attribute options.
-
#override ⇒ Object
Returns the value of attribute override.
-
#records ⇒ Object
Returns the value of attribute records.
-
#table_class ⇒ Object
Returns the value of attribute table_class.
-
#table_id ⇒ Object
Returns the value of attribute table_id.
Class Method Summary collapse
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(args = {}) ⇒ Base
constructor
A new instance of Base.
- #render ⇒ Object
- #rows ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 21 22 |
# File 'lib/render_table/base.rb', line 14 def initialize(args = {}) @records = args[:records] || [] @header = args[:header] || [] @override = args[:override] || {} @table_id = args[:table_id] || RenderTable.config.table_id @table_class = args[:table_class] || RenderTable.config.table_class @html = args[:html] || RenderTable.config.html = args[:options] end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def header @header end |
#html ⇒ Object
Returns the value of attribute html.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def html @html end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def end |
#override ⇒ Object
Returns the value of attribute override.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def override @override end |
#records ⇒ Object
Returns the value of attribute records.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def records @records end |
#table_class ⇒ Object
Returns the value of attribute table_class.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def table_class @table_class end |
#table_id ⇒ Object
Returns the value of attribute table_id.
6 7 8 |
# File 'lib/render_table/base.rb', line 6 def table_id @table_id end |
Class Method Details
.render(args = {}) {|table| ... } ⇒ Object
8 9 10 11 12 |
# File 'lib/render_table/base.rb', line 8 def self.render(args = {}) table = new(args) yield table table.render end |
Instance Method Details
#context ⇒ Object
32 33 34 |
# File 'lib/render_table/base.rb', line 32 def context binding end |
#render ⇒ Object
28 29 30 |
# File 'lib/render_table/base.rb', line 28 def render ERB.new(template, 0, '%<>').result(binding) end |
#rows ⇒ Object
24 25 26 |
# File 'lib/render_table/base.rb', line 24 def rows RenderTable::Row.rows_for_table(self) end |