
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Railway oriented aproach for your classes. Operabl let you define steps in your class or module to be executed sequentially. Steps can be class methods, procs or other Operabl classes/modules.
Add this line to your application's Gemfile:
gem 'operabl'
And then execute:
$ bundle
Or install it yourself as:
$ gem install operabl
Include Operable in your Class/Module. Steps can be class methods, procs or other Operabl class/module
class ProcOp
include Operabl
step ->(ctx) {
ctx[:key] = ctx.params[:pkey]
ctx[:amethod_call] = amethod
}
def self.amethod
return "something else"
end
end
op = ProcOp.call({pkey: "something"})
op.failure? # => false
op.success? # => true
op[:key] # => "something"
op[:amethod_call] # => "something else"
Steps are Class level methods. This is because steps only work with a context provided, they don't change classes state.
class MethodOp
include Operabl
step :a
def self.a(ctx)
ctx[:key] = ctx.params[:pkey]
end
end
op = MethodOp.call({pkey: "something"})
op.success? # => true
op.result # => {}
Another example of an Operabl as a step.
class ComposedOp
include Operabl
step MethodOp
step :b
def self.b(ctx)
ctx.success!({status: 200, response: "OK"})
end
end
op = ComposedOp.call({pkey: "something else"})
op.success? # => true
op[:key] # => "something else"
op.result # => {status: 200, response: "OK"}
The result from #call is a Operabl::Context, it can be passed to a new Operabl call.
If Operation failed, AnotherOp is not going to succed but it will run any :failure step defined in it.
class AnotherOp
include Operabl
step :a
failure :b
def self.a(ctx)
#do something
end
def self.b(ctx)
#recover from failure
end
end
op = Operation.call({pkey: "something else"})
op2 = AnotherOp.call(op)
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that operabl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.