Class: Riddler::Steps::Content

Inherits:
Riddler::Step show all
Defined in:
lib/riddler/steps/content.rb

Instance Attribute Summary

Attributes inherited from Riddler::Step

#context, #definition, #preview_enabled

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Riddler::Step

for, inherited, #initialize, subclasses

Methods included from Includeable

#include?, #include_predicate

Constructor Details

This class inherits a constructor from Riddler::Step

Class Method Details

.typeObject



4
5
6
# File 'lib/riddler/steps/content.rb', line 4

def self.type
  "content"
end

Instance Method Details

#elementsObject



8
9
10
11
12
13
14
# File 'lib/riddler/steps/content.rb', line 8

def elements
  @elements ||= definition["elements"]
    .map do |element_definition|
      ::Riddler::Element.for element_definition, context
    end
    .select(&:include?)
end

#to_hashObject



16
17
18
19
20
21
22
# File 'lib/riddler/steps/content.rb', line 16

def to_hash
  hash = super
  hash["elements"] = elements.map do |element|
    element.to_hash
  end
  hash
end