Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/dom.rb
Instance Method Summary collapse
Instance Method Details
#dom(tag, mounted: nil, **attr) ⇒ Object
117 118 119 120 121 122 123 124 125 |
# File 'lib/dom.rb', line 117 def dom tag, mounted: nil, **attr error_objs = select{|e| e.kind_of?(String).!} unless error_objs.empty? raise "All array elements must be a string: #{error_objs.first.inspect}" end _tag = Dom.hyphenize(tag) ("<%s%s>%s</%s>".freeze % [_tag, Dom.attr(attr), Dom.join(self, tag), _tag]) .dom_escaped.mounted_set(*map(&:mounted), mounted) end |
#jsonml(tag, attr = nil) ⇒ Object
126 |
# File 'lib/dom.rb', line 126 def jsonml tag, attr = nil; [Dom.hyphenize(tag), *([Dom.json_attr(attr)] if attr), *self] end |