Class: SimpleTable::Tag
- Inherits:
-
Object
- Object
- SimpleTable::Tag
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/simple_table/tag.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #add_class(klass) ⇒ Object
- #collection_class ⇒ Object
- #collection_name ⇒ Object
- #head? ⇒ Boolean
-
#initialize(parent = nil, options = {}) ⇒ Tag
constructor
A new instance of Tag.
- #render(content = nil, escape = false) {|content = ''| ... } ⇒ Object
- #table ⇒ Object
Constructor Details
#initialize(parent = nil, options = {}) ⇒ Tag
Returns a new instance of Tag.
9 10 11 12 |
# File 'lib/simple_table/tag.rb', line 9 def initialize(parent = nil, = {}) @parent = parent @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/simple_table/tag.rb', line 7 def @options end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/simple_table/tag.rb', line 7 def parent @parent end |
Instance Method Details
#add_class(klass) ⇒ Object
36 37 38 |
# File 'lib/simple_table/tag.rb', line 36 def add_class(klass) add_class!(, klass) end |
#collection_class ⇒ Object
14 15 16 |
# File 'lib/simple_table/tag.rb', line 14 def collection_class table.collection_class end |
#collection_name ⇒ Object
18 19 20 |
# File 'lib/simple_table/tag.rb', line 18 def collection_name table.collection_name end |
#head? ⇒ Boolean
26 27 28 |
# File 'lib/simple_table/tag.rb', line 26 def head? is_a?(Head) || !!parent.try(:head?) end |
#render(content = nil, escape = false) {|content = ''| ... } ⇒ Object
30 31 32 33 34 |
# File 'lib/simple_table/tag.rb', line 30 def render(content = nil, escape = false) yield(content = '') if content.nil? && block_given? content = lf(indent(content.to_s)) lf(content_tag(tag_name, content, , escape)) end |
#table ⇒ Object
22 23 24 |
# File 'lib/simple_table/tag.rb', line 22 def table is_a?(Table) ? self : parent.try(:table) end |