class Macros::Model::Persist
Persist
object from the context @example
step Macros::Model::Persist(ctx_key: :weekly_plan_editing)
Public Class Methods
new(ctx_key: :model, method: :save!)
click to toggle source
# File lib/macros/model/persist.rb, line 9 def initialize(ctx_key: :model, method: :save!) @ctx_key = ctx_key @method = method end
Public Instance Methods
call(ctx, **)
click to toggle source
# File lib/macros/model/persist.rb, line 14 def call(ctx, **) return false unless ctx[@ctx_key] ctx[@ctx_key].public_send(@method) end