Module: FormatHelper

Instance Method Summary collapse

Instance Method Details

#parse_content_or_options(content_or_options, options) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/format_helper.rb', line 11

def parse_content_or_options(content_or_options, options)
  if content_or_options.is_a?(Hash)
    [nil, content_or_options]
  else
    [content_or_options, options]
  end
end

#prepend_class(options, *attrs) ⇒ Object



7
8
9
# File 'app/helpers/format_helper.rb', line 7

def prepend_class(options, *attrs)
  options[:class] = squeeze_n_strip("#{attrs.join(' ')} #{options[:class]}")
end

#squeeze_n_strip(string = '') ⇒ Object



3
4
5
# File 'app/helpers/format_helper.rb', line 3

def squeeze_n_strip(string='')
  string.squeeze(' ').strip
end