Skip to content

Commit

Permalink
feat: OpenFeature::SDK.configure (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Nichols <[email protected]>
  • Loading branch information
technicalpickles authored Dec 14, 2022
1 parent 73bf99d commit 7587799
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/openfeature/sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,18 @@ module OpenFeature
# TODO: Add documentation
#
module SDK
class << self
def method_missing(method_name, *args, **kwargs, &block)
if API.instance.respond_to?(method_name)
API.instance.send(method_name, *args, **kwargs, &block)
else
super
end
end

def respond_to_missing?(method_name, include_private = false)
API.instance.respond_to?(method_name, include_private) || super
end
end
end
end
8 changes: 8 additions & 0 deletions spec/openfeature/sdk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
it "has a version number" do
expect(OpenFeature::SDK::VERSION).not_to be_nil
end

it "can be configured" do
expect(OpenFeature::SDK).to respond_to(:configure)

OpenFeature::SDK.configure do |config|
# don't test here, rely on OpenFeature::SDK::API instead
end
end
end

0 comments on commit 7587799

Please sign in to comment.