Class: SimpleDataPresentation::HtmlOptions

Inherits:
HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/simple_data_presentation/html_options.rb

Instance Method Summary collapse

Instance Method Details

#regular_writer(key, value) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/simple_data_presentation/html_options.rb', line 2

def regular_writer(key, value)
	super key, case key
	when "class"
		value.nil? ? nil : (self[key].present? ? self[key].to_s << " #{value}" : "#{value}")
	when "data"
		value.is_a?(Hash) ? (self[key].is_a?(Hash) ? self[key].merge(value) : value.with_indifferent_access) : value
	when "style"
	  value.nil? ? nil : (self[key].present? ? self[key].to_s << " #{value}" : "#{value}")
	else
		"#{value}"
	end
end