module Enumerable
Public Instance Methods
component_map() { |e| ... }
click to toggle source
Maps the given block to each element of enum. The result of each iteration is added to an HTMLComponent::Builder
instance, which is returned after the final iteration.
If no block is given, an enumerator is returned instead.
# File lib/html-native/collections.rb, line 10 def component_map if block_given? result = HTMLComponent::Builder.new each do |e| result += yield(e) end result else to_enum(:component_map) end end
to_ol(attributes: {})
click to toggle source
Returns an OrderedListComponent
representing the enum.
See OrderedListComponent#new for details on how to apply attributes.
# File lib/html-native/collections.rb, line 25 def to_ol(attributes: {}) OrderedListComponent.new(self, attributes: attributes) end
to_ul(attributes: {})
click to toggle source
Returns an UnorderedListComponent
representing the enum.
See UnorderedListComponent#new for details on how to apply attributes.
# File lib/html-native/collections.rb, line 32 def to_ul(attributes: {}) UnorderedListComponent.new(self, attributes: attributes) end