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



27
28
29
# File 'lib/essay/helpers/serialize_helper.rb', line 27

def serialize_steps
  self.class.serialize_steps
end

#to_hashObject



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

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