This repository has been archived by the owner on Feb 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing name collisions, fixed adding pavlov options, removed creating…
… pavlov_options in compatablity layer.
- Loading branch information
Showing
2 changed files
with
17 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,26 +30,22 @@ def self.arguments_to_attributes(operation_class, arguments) | |
|
||
module Helpers | ||
def old_interactor name, *args | ||
args = add_pavlov_options args | ||
args = add_compatablity_pavlov_options args | ||
Pavlov.old_interactor name, *args | ||
end | ||
|
||
def old_query name, *args | ||
args = add_pavlov_options args | ||
args = add_compatablity_pavlov_options args | ||
Pavlov.old_query name, *args | ||
end | ||
|
||
def old_command name, *args | ||
args = add_pavlov_options args | ||
args = add_compatablity_pavlov_options args | ||
Pavlov.old_command name, *args | ||
end | ||
|
||
def pavlov_options | ||
{} | ||
end | ||
|
||
private | ||
def add_pavlov_options args | ||
def add_compatablity_pavlov_options args | ||
# TODO: we should do this at a point where we know how many arguments we need | ||
# so we can decide if we need to merge with another options object or | ||
# just add it. | ||
|
@@ -67,9 +63,6 @@ def arguments(*args) | |
args.each do |argument| | ||
attribute argument, Object | ||
end | ||
|
||
# Add attribute for pavlov_options | ||
attribute :pavlov_options, Hash, default: {} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jjoos
Author
Member
|
||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
module Pavlov | ||
module Helpers | ||
def interactor name, *args | ||
args = add_pavlov_options args | ||
Pavlov.interactor name, *args | ||
def interactor name, hash | ||
hash = add_pavlov_options hash | ||
Pavlov.interactor name, hash | ||
end | ||
|
||
def query name, *args | ||
args = add_pavlov_options args | ||
Pavlov.query name, *args | ||
def query name, hash | ||
hash = add_pavlov_options hash | ||
Pavlov.query name, hash | ||
end | ||
|
||
def command name, *args | ||
args = add_pavlov_options args | ||
Pavlov.command name, *args | ||
def command name, hash | ||
hash = add_pavlov_options hash | ||
Pavlov.command name, hash | ||
end | ||
|
||
def pavlov_options | ||
{} | ||
end | ||
|
||
private | ||
def add_pavlov_options args | ||
# TODO: we should do this at a point where we know how many arguments we need | ||
# so we can decide if we need to merge with another options object or | ||
# just add it. | ||
def add_pavlov_options hash | ||
if pavlov_options != {} | ||
args << pavlov_options | ||
hash ||= {} | ||
hash[:pavlov_options] = pavlov_options.merge(hash[:pavlov_options]) | ||
end | ||
args | ||
hash | ||
end | ||
end | ||
end |
If you remove this, they won't be magically available, and you'd have to add them to each operation that needs it. Is that what you wanted?