-
Notifications
You must be signed in to change notification settings - Fork 9
Macro::Assign
Vladislav Trotsenko edited this page Sep 27, 2019
·
2 revisions
Provides to assign into context value from other context/context chains.
class SomeOperation < ApplicationOperation
# ctx[:some_attribute] = ctx['contract.default'].some_attribute
step Macro::Assign(to: :some_attribute, path: %w[contract.default some_attribute])
# ctx[:model] = ctx[:current_account].user
step Macro::Assign(to: :model, path: %i[current_account user])
end
class SomeOperation < ApplicationOperation
step Macro::Assign(
to: :model,
path: %i[current_account not_existing_method],
try: true
) # ctx[:model] => nil
end
class SomeOperation < ApplicationOperation
# ctx[:some_attribute] = :some_value
step Macro::Assign(to: :some_attribute, value: :some_value)
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!