Module: TagHelper
- Includes:
- Support
- Defined in:
- lib/social_nets_db/tag_helper.rb
Instance Method Summary
collapse
Methods included from Support
#present_str?
validate_argument_boolean!, validate_argument_positive!, validate_argument_presence!, validate_argument_type!, validate_collection_item_types!
Instance Method Details
#merge_class_values(existing:, incoming:) ⇒ Object
31
32
33
34
|
# File 'lib/social_nets_db/tag_helper.rb', line 31
def merge_class_values(existing:, incoming:)
return existing unless present_str? incoming
[existing, incoming]
end
|
#merge_style_values(existing:, incoming:) ⇒ Object
26
27
28
29
|
# File 'lib/social_nets_db/tag_helper.rb', line 26
def merge_style_values(existing:, incoming:)
return existing unless present_str? incoming
[existing, "#{incoming};"].join("; ").gsub(";;", ";")
end
|
#tag_attributes_to_s(options) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/social_nets_db/tag_helper.rb', line 9
def tag_attributes_to_s(options)
fail ArgumentError, "A Hash must be passed, you pass #{options.class}: #{options.inspect}" unless options.is_a? Hash
options.map { |pair| stringify_pair(*pair) }
.reject { |stringified_attribute| [nil, ""].include?(stringified_attribute) }
.join(" ")
end
|