Class: Card::Format::HtmlFormat

Inherits:
Card::Format show all
Defined in:
lib/card/format/html_format.rb

Overview

Main Format class for formatting card views in HTML

Direct Known Subclasses

RssFormat

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#options_need_saveObject

Returns the value of attribute options_need_save.



9
10
11
# File 'lib/card/format/html_format.rb', line 9

def options_need_save
  @options_need_save
end

#skip_autosaveObject

Returns the value of attribute skip_autosave.



9
10
11
# File 'lib/card/format/html_format.rb', line 9

def skip_autosave
  @skip_autosave
end

#start_timeObject

Returns the value of attribute start_time.



9
10
11
# File 'lib/card/format/html_format.rb', line 9

def start_time
  @start_time
end

Instance Method Details

#escape_literal(literal) ⇒ Object



20
21
22
# File 'lib/card/format/html_format.rb', line 20

def escape_literal literal
  "<span>#{literal}</span>"
end

#final_render_call(method) ⇒ Object



28
29
30
31
# File 'lib/card/format/html_format.rb', line 28

def final_render_call method
  rendered = super
  rendered.is_a?(Array) ? output(rendered) : rendered
end

#focal?Boolean

is the current card the requested card?

Returns:

  • (Boolean)


16
17
18
# File 'lib/card/format/html_format.rb', line 16

def focal?
  @focal ||= show_layout? ? main? : depth.zero?
end

#main?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/card/format/html_format.rb', line 11

def main?
  !@main.nil?
end

#mime_typeObject



24
25
26
# File 'lib/card/format/html_format.rb', line 24

def mime_type
  "text/html"
end


33
34
35
# File 'lib/card/format/html_format.rb', line 33

def stylesheet_link_tag path
  tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
end