Module: RubyClaude
- Defined in:
- lib/ruby_claude.rb,
lib/ruby_claude/event.rb,
lib/ruby_claude/client.rb,
lib/ruby_claude/errors.rb,
lib/ruby_claude/runner.rb,
lib/ruby_claude/command.rb,
lib/ruby_claude/session.rb,
lib/ruby_claude/version.rb,
lib/ruby_claude/response.rb,
lib/ruby_claude/configuration.rb
Overview
Ruby Claude — a subscription-authenticated Ruby SDK that talks to Claude by shelling out to the Claude Code CLI (+claude -p+) in headless mode.
It is an unofficial, community wrapper around a supported headless feature.
By default it strips ANTHROPIC_API_KEY from the child environment so calls
draw on the logged-in Pro/Max subscription rather than API billing.
Defined Under Namespace
Classes: AuthenticationError, BinaryNotFoundError, Client, Command, Configuration, Error, Event, ExecutionError, ParseError, Response, RunResult, Runner, Session, TimeoutError
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
-
.configuration ⇒ Configuration
The global configuration used by RubyClaude.query and as the default for new Client instances.
-
.configure {|config| ... } ⇒ Configuration
Configure the global defaults.
-
.default_client ⇒ Client
The memoized default Client, rebuilt whenever RubyClaude.configure is called.
-
.query(prompt, **options) ⇒ Response
One-shot convenience that delegates to a memoized default Client.
-
.reset_configuration! ⇒ void
Reset all global state.
Class Method Details
.configuration ⇒ Configuration
32 33 34 |
# File 'lib/ruby_claude.rb', line 32 def configuration @configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ Configuration
Configure the global defaults.
40 41 42 43 44 |
# File 'lib/ruby_claude.rb', line 40 def configure yield configuration if block_given? @default_client = nil # rebuild with the new configuration on next use configuration end |
.default_client ⇒ Client
66 67 68 |
# File 'lib/ruby_claude.rb', line 66 def default_client @default_client ||= Client.new end |
.query(prompt, **options) ⇒ Response
One-shot convenience that delegates to a memoized default Client.
59 60 61 |
# File 'lib/ruby_claude.rb', line 59 def query(prompt, **) default_client.query(prompt, **) end |
.reset_configuration! ⇒ void
This method returns an undefined value.
Reset all global state. Mainly useful in tests.
49 50 51 52 |
# File 'lib/ruby_claude.rb', line 49 def reset_configuration! @configuration = Configuration.new @default_client = nil end |