Class: Tableficate::Caption
- Inherits:
-
Object
- Object
- Tableficate::Caption
- Defined in:
- lib/tableficate/caption.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ Caption
constructor
A new instance of Caption.
- #value ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ Caption
Returns a new instance of Caption.
5 6 7 8 9 10 11 12 13 |
# File 'lib/tableficate/caption.rb', line 5 def initialize(*args, &block) if block_given? @attrs = args.first || {} @content = block else @content = args[0] @attrs = args[1] || {} end end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
3 4 5 |
# File 'lib/tableficate/caption.rb', line 3 def attrs @attrs end |
Instance Method Details
#value ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tableficate/caption.rb', line 15 def value if @content.is_a?(String) @content else output = @content.call if output.is_a?(ActionView::OutputBuffer) '' else output = output.html_safe if output.respond_to? :html_safe output end end end |