Module: Essay::SerializeHelper

Extended by:
ActiveSupport::Concern
Included in:
AbstractFeature, AbstractFeatures
Defined in:
lib/essay/helpers/serialize_helper.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#serialize_stepsObject



25
26
27
# File 'lib/essay/helpers/serialize_helper.rb', line 25

def serialize_steps
  self.class.serialize_steps
end

#to_hashObject



16
17
18
19
20
21
22
23
# File 'lib/essay/helpers/serialize_helper.rb', line 16

def to_hash
  serialize_steps.each_with_object({}) do |step, result|
    condition = step.fetch(:options)[:if]
    if !condition || try(condition)
      result.merge!(instance_exec(&step.fetch(:block)))
    end
  end
end