Class: Riddler::Elements::Varient

Inherits:
Riddler::Element show all
Defined in:
lib/riddler/elements/variant.rb

Instance Attribute Summary

Attributes inherited from Riddler::Element

#context, #definition

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Riddler::Element

for, inherited, #initialize, subclasses

Methods included from Includeable

#include?, #include_predicate

Constructor Details

This class inherits a constructor from Riddler::Element

Class Method Details

.typeObject



4
5
6
# File 'lib/riddler/elements/variant.rb', line 4

def self.type
  "variant"
end

Instance Method Details

#included_elementObject



12
13
14
15
16
17
18
# File 'lib/riddler/elements/variant.rb', line 12

def included_element
  definition["elements"]
    .map do |hash|
      ::Riddler::Element.for hash, context
    end
    .detect(&:include?)
end

#to_hashObject



8
9
10
# File 'lib/riddler/elements/variant.rb', line 8

def to_hash
  included_element.to_hash
end