Module: TipTap::HtmlRenderable

Includes:
ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TextHelper
Included in:
Node
Defined in:
lib/tip_tap/html_renderable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_bufferObject

ActionView::Helpers::TagHelper requires output_buffer accessor This is included by ActionView::Helpers::TextHelper



12
13
14
# File 'lib/tip_tap/html_renderable.rb', line 12

def output_buffer
  @output_buffer
end

Class Method Details

.included(base) ⇒ Object



14
15
16
# File 'lib/tip_tap/html_renderable.rb', line 14

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#html_class_nameObject



46
47
48
49
50
51
52
53
54
# File 'lib/tip_tap/html_renderable.rb', line 46

def html_class_name
  classes = self.class.html_class_name
  case classes
  when Proc
    instance_eval(&classes)
  else
    classes
  end
end

#html_tagObject



36
37
38
39
40
41
42
43
44
# File 'lib/tip_tap/html_renderable.rb', line 36

def html_tag
  tag = self.class.html_tag
  case tag
  when Proc
    instance_eval(&tag)
  else
    tag
  end
end

#to_htmlObject



56
57
58
# File 'lib/tip_tap/html_renderable.rb', line 56

def to_html
  (html_tag, safe_join(content.map(&:to_html)), class: html_class_name)
end