Class: Effigy::ExampleElementTransformer
- Inherits:
-
Object
- Object
- Effigy::ExampleElementTransformer
- Defined in:
- lib/effigy/example_element_transformer.rb
Overview
Performs transformations based on an array of example elements. Used internally.
Instance Method Summary (collapse)
-
- (ExampleElementTransformer) initialize(view, example_elements)
constructor
A new instance of ExampleElementTransformer.
-
- (Object) replace_each(collection, &block)
Replaces the example elements with a clone for each item in the collection.
Constructor Details
- (ExampleElementTransformer) initialize(view, example_elements)
A new instance of ExampleElementTransformer
5 6 7 8 |
# File 'lib/effigy/example_element_transformer.rb', line 5 def initialize(view, example_elements) @view = view @example_elements = example_elements end |
Instance Method Details
- (Object) replace_each(collection, &block)
Replaces the example elements with a clone for each item in the collection. Only the first example element will be used for cloning, but all example elements will be removed.
16 17 18 19 |
# File 'lib/effigy/example_element_transformer.rb', line 16 def replace_each(collection, &block) clone_and_transform_each(collection, &block) remove_all end |