Class: Riddler::Steps::Variant

Inherits:
Riddler::Step show all
Defined in:
lib/riddler/steps/variant.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/variant.rb', line 4

def self.type
  "variant"
end

Instance Method Details

#included_stepObject



14
15
16
# File 'lib/riddler/steps/variant.rb', line 14

def included_step
  steps.detect &:include?
end

#stepsObject



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

def steps
  @steps ||= definition["steps"].map do |hash|
    ::Riddler::Step.for hash, context
  end
end

#to_hashObject



18
19
20
# File 'lib/riddler/steps/variant.rb', line 18

def to_hash
  included_step&.to_hash
end