ruby-ode
ruby-ode is the Ruby member of the ODE runtime family.
It provides:
- direct
UseCaseexecution ChainUseCasedependent comparison flowSequenceUseCaseordered execution- guard-first rejection before business work begins
Narrative Readability
ODE is designed so code can be read as narrative. A developer should be able to identify guard, execute, chain, sequence, dispatch and publish steps even in a language they do not use every day.
This does not mean every runtime has identical syntax. It means the conceptual reading path remains stable enough that a Java developer can follow a Go or Ruby flow, and a Swift developer can follow a TypeScript or Python flow, without relearning the product story from scratch.
What ODE Does Not Claim
ODE does not promise identical syntax across languages, and it does not remove the need to understand native platform idioms. It also does not require every runtime to expose the same UI layer.
The reason is pragmatic: forcing textual symmetry across Kotlin, Swift, Go, Ruby, PHP, TypeScript or Python would usually make the libraries feel unnatural inside their host ecosystems. ODE prefers semantic stability over artificial syntactic cloning.
Validation
ruby -Ilib test/test_runtime.rb
Repository
Coordinates
- gem:
ruby-ode - version:
0.1.0
Public API
RubyODE::UseCaseRubyODE::ChainUseCaseRubyODE::SequenceUseCaseRubyODE::UseCaseDispatcherRubyODE::ValueOutput,RubyODE::ErrorOutput,RubyODE::EmptyOutput,RubyODE::OutputsRubyODE::HttpError,RubyODE::ConnectionError,RubyODE::GuardRejectedError,RubyODE::UnexpectedResponseError
Core Concepts
1. UseCase
RubyODE::UseCase keeps guard, execution and output normalization in the same explicit template flow.
2. ChainUseCase
RubyODE::ChainUseCase models a two-step dependent narrative.
3. SequenceUseCase
RubyODE::SequenceUseCase preserves input order across three or more values.
4. UseCaseDispatcher
RubyODE::UseCaseDispatcher triggers a use case and can yield the same output to a block for publication.
Basic Examples
Direct UseCase
class LoadPokemonUseCase < RubyODE::UseCase
def execute(param)
"spotlight:#{param}"
end
end
Guarded UseCase
class ComparePokemonUseCase < RubyODE::UseCase
def guard(param)
raise RubyODE::GuardRejectedError, "comparison requires distinct entries" if param[0] == param[1]
end
def execute(param)
"#{param[0]} vs #{param[1]}"
end
end
Publish While Dispatching
dispatcher = RubyODE::UseCaseDispatcher.new
output = dispatcher.dispatch("pikachu", LoadPokemonUseCase.new) do |result|
puts result.inspect
end