Skip to content

Instantly share code, notes, and snippets.

@maxim
Last active September 17, 2023 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxim/d0c1da8f1424814ba20763e390b01145 to your computer and use it in GitHub Desktop.
Save maxim/d0c1da8f1424814ba20763e390b01145 to your computer and use it in GitHub Desktop.
option :foo_a
option :foo_b, value: {type: Integer}
option :bar_x, value: {type: String}
option :bar_y
option :bar_z, value: {type: Integer}
attr_reader :kwargs
def self.from_options(options)
new \
foo: {
a: options[:foo_a],
b: options[:foo_b],
},
bar: {
x: options[:bar_x],
y: options[:bar_y],
z: options[:bar_z]
}
end
def initialize(kwargs)
@kwargs = kwargs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment