Skip to content

Commit 7587799

Browse files
feat: OpenFeature::SDK.configure (#41)
Signed-off-by: Josh Nichols <[email protected]>
1 parent 73bf99d commit 7587799

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/openfeature/sdk.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,18 @@ module OpenFeature
77
# TODO: Add documentation
88
#
99
module SDK
10+
class << self
11+
def method_missing(method_name, *args, **kwargs, &block)
12+
if API.instance.respond_to?(method_name)
13+
API.instance.send(method_name, *args, **kwargs, &block)
14+
else
15+
super
16+
end
17+
end
18+
19+
def respond_to_missing?(method_name, include_private = false)
20+
API.instance.respond_to?(method_name, include_private) || super
21+
end
22+
end
1023
end
1124
end

spec/openfeature/sdk_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
it "has a version number" do
55
expect(OpenFeature::SDK::VERSION).not_to be_nil
66
end
7+
8+
it "can be configured" do
9+
expect(OpenFeature::SDK).to respond_to(:configure)
10+
11+
OpenFeature::SDK.configure do |config|
12+
# don't test here, rely on OpenFeature::SDK::API instead
13+
end
14+
end
715
end

0 commit comments

Comments
 (0)