-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Final Version Wihout Specs * Fixes and specs * Fixes for specs * Update deps * Move dev deps to the Gemfile * Increase coverage
- Loading branch information
1 parent
ccb98ee
commit 2851014
Showing
12 changed files
with
346 additions
and
117 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
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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resol | ||
class Configuration | ||
DEFAULT_RETURN_ENGINE = ReturnEngine::Catch | ||
|
||
class << self | ||
def configure | ||
SmartCore::Initializer::Configuration.configure do |c| | ||
self.smartcore_config = c | ||
yield self | ||
self.smartcore_config = nil | ||
end | ||
end | ||
|
||
def return_engine | ||
@return_engine || DEFAULT_RETURN_ENGINE | ||
end | ||
|
||
def return_engine=(engine) | ||
@return_engine = engine | ||
end | ||
|
||
private | ||
|
||
attr_accessor :smartcore_config | ||
|
||
def method_missing(meth, *args, &block) | ||
# rubocop:disable Style/SafeNavigation | ||
if smartcore_config && smartcore_config.respond_to?(meth) | ||
# rubocop:enable Style/SafeNavigation | ||
smartcore_config.__send__(meth, *args, &block) | ||
else | ||
super(meth, *args, &block) | ||
end | ||
end | ||
|
||
def respond_to_missing?(meth, include_private) | ||
smartcore_config.respond_to?(meth, include_private) | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resol | ||
module ReturnEngine | ||
NOT_EXITED = Object.new.freeze | ||
DataWrapper = Struct.new(:data) | ||
end | ||
end | ||
|
||
require_relative "return_engine/catch" | ||
require_relative "return_engine/return" |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resol | ||
module ReturnEngine | ||
module Catch | ||
extend self | ||
|
||
def wrap_call(service) | ||
catch(service) do | ||
yield | ||
NOT_EXITED | ||
end | ||
end | ||
|
||
def uncaught_call?(return_obj) | ||
return_obj == NOT_EXITED | ||
end | ||
|
||
def handle_return(service, data) | ||
throw(service, data) | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resol | ||
module ReturnEngine | ||
module Return | ||
extend self | ||
|
||
def wrap_call(_service) | ||
yield | ||
end | ||
|
||
def uncaught_call?(return_obj) | ||
!return_obj.is_a?(Resol::Service::Result) | ||
end | ||
|
||
def handle_return(_service, data) | ||
data | ||
end | ||
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
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,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resol | ||
VERSION = "0.8.0" | ||
VERSION = "0.9.0" | ||
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
Oops, something went wrong.