Module: Rbexy::ViewContextHelper

Included in:
Runtime
Defined in:
lib/rbexy/view_context_helper.rb

Instance Method Summary collapse

Instance Method Details

#rbexy_is_html_safe_array?(value) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rbexy/view_context_helper.rb', line 15

def rbexy_is_html_safe_array?(value)
  value.is_a?(Array) && value.all? { |v| v.respond_to?(:html_safe?) && v.html_safe? }
end

#rbexy_prep_output(*value) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/rbexy/view_context_helper.rb', line 7

def rbexy_prep_output(*value)
  return if value.length == 0
  value = value.first

  value = rbexy_is_html_safe_array?(value) ? value.join.html_safe : value
  [nil, false].include?(value) ? "" : value.to_s
end

#rbexy_tagObject



3
4
5
# File 'lib/rbexy/view_context_helper.rb', line 3

def rbexy_tag
  @rbexy_tag ||= Runtime.create_tag_builder(self)
end