Module: WrapIt::TextContainer::ClassMethods

Defined in:
lib/wrap_it/text_container.rb

Instance Method Summary collapse

Instance Method Details

#html_safe(value = nil) ⇒ Boolean

Sets whether text from arguments are html-safe

Parameters:

  • value (Boolean) (defaults to: nil)

    true means that text from arguments have proper markup and component will mark it as save via html_safe method. flase means, that this values can contain unsafe content, so user should make html-safe string by itself.

Returns:

  • (Boolean)

    current value



84
85
86
87
88
89
90
91
# File 'lib/wrap_it/text_container.rb', line 84

def html_safe(value = nil)
  if value.nil?
    @html_safe.nil? && @html_safe = true
    @html_safe
  else
    @html_safe = value == true
  end
end

#html_safe?Boolean

Retrieves whether text from attributes are html-safe

Returns:

  • (Boolean)

    current value



97
98
99
100
# File 'lib/wrap_it/text_container.rb', line 97

def html_safe?
  @html_safe.nil? && @html_safe = true
  @html_safe
end

#text_in_block(value = nil) ⇒ Boolean

Sets priotiy of text source

Parameters:

  • value (Boolean) (defaults to: nil)

    true means if block present - text will be captured from there. false means first to inspect arguments and options and if it ommited retirieve text from block.

Returns:

  • (Boolean)

    current value



58
59
60
61
62
63
64
65
# File 'lib/wrap_it/text_container.rb', line 58

def text_in_block(value = nil)
  if value.nil?
    @text_in_block.nil? && @text_in_block = true
    @text_in_block
  else
    @text_in_block = value == true
  end
end

#text_in_block?Boolean

Retrieves block priority

Returns:

  • (Boolean)

    current value



71
72
73
74
# File 'lib/wrap_it/text_container.rb', line 71

def text_in_block?
  @text_in_block.nil? && @text_in_block = true
  @text_in_block
end