Skip to content

Commit 1bd36b9

Browse files
committed
feat: add the option type and result type
0 parents  commit 1bd36b9

File tree

19 files changed

+683
-0
lines changed

19 files changed

+683
-0
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Matrix Test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
- dev
10+
11+
concurrency:
12+
group: ${{ github.sha }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
name: Ruby ${{ matrix.ruby }}
19+
strategy:
20+
matrix:
21+
ruby:
22+
- "2.7.0"
23+
- "3.0.0"
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: ${{ matrix.ruby }}
31+
bundler-cache: true
32+
- name: Run the default task
33+
run: bundle exec rake

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
# rspec failure tracking
11+
.rspec_status

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
inherit_gem:
2+
rubocop-config-crystal: .rubocop.yml
3+
4+
Metrics/BlockLength:
5+
Enabled: false
6+
7+
Style/MethodCallWithArgsParentheses:
8+
Enabled: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## [Unreleased]
2+
3+
## [0.1.0] - 2025-11-06
4+
5+
- Initial release

Gemfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
# Specify your gem's dependencies in rs-result.gemspec
6+
gemspec
7+
8+
gem "bundler", "~> 2.4"
9+
10+
gem "rake", "~> 13.0"
11+
12+
gem "rspec", "~> 3.0"
13+
14+
gem "rubocop", "~> 1.21"
15+
16+
gem "rubocop-config-crystal"

Gemfile.lock

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
PATH
2+
remote: .
3+
specs:
4+
rs-result (0.1.0)
5+
6+
GEM
7+
remote: https://rubygems.org/
8+
specs:
9+
ast (2.4.3)
10+
diff-lcs (1.6.2)
11+
json (2.15.2)
12+
language_server-protocol (3.17.0.5)
13+
lint_roller (1.1.0)
14+
parallel (1.27.0)
15+
parser (3.3.10.0)
16+
ast (~> 2.4.1)
17+
racc
18+
prism (1.6.0)
19+
racc (1.8.1)
20+
rainbow (3.1.1)
21+
rake (13.3.1)
22+
regexp_parser (2.11.3)
23+
rspec (3.13.2)
24+
rspec-core (~> 3.13.0)
25+
rspec-expectations (~> 3.13.0)
26+
rspec-mocks (~> 3.13.0)
27+
rspec-core (3.13.6)
28+
rspec-support (~> 3.13.0)
29+
rspec-expectations (3.13.5)
30+
diff-lcs (>= 1.2.0, < 2.0)
31+
rspec-support (~> 3.13.0)
32+
rspec-mocks (3.13.7)
33+
diff-lcs (>= 1.2.0, < 2.0)
34+
rspec-support (~> 3.13.0)
35+
rspec-support (3.13.6)
36+
rubocop (1.81.7)
37+
json (~> 2.3)
38+
language_server-protocol (~> 3.17.0.2)
39+
lint_roller (~> 1.1.0)
40+
parallel (~> 1.10)
41+
parser (>= 3.3.0.2)
42+
rainbow (>= 2.2.2, < 4.0)
43+
regexp_parser (>= 2.9.3, < 3.0)
44+
rubocop-ast (>= 1.47.1, < 2.0)
45+
ruby-progressbar (~> 1.7)
46+
unicode-display_width (>= 2.4.0, < 4.0)
47+
rubocop-ast (1.47.1)
48+
parser (>= 3.3.7.2)
49+
prism (~> 1.4)
50+
rubocop-config-crystal (0.0.1)
51+
ruby-progressbar (1.13.0)
52+
unicode-display_width (3.2.0)
53+
unicode-emoji (~> 4.1)
54+
unicode-emoji (4.1.0)
55+
56+
PLATFORMS
57+
x86_64-linux
58+
59+
DEPENDENCIES
60+
bundler (~> 2.4)
61+
rake (~> 13.0)
62+
rs-result!
63+
rspec (~> 3.0)
64+
rubocop (~> 1.21)
65+
rubocop-config-crystal
66+
67+
BUNDLED WITH
68+
2.4.22

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Rs::Result
2+
3+
Bring the Rust [Result Option] type to Ruby
4+
5+
## Installation
6+
7+
Install the gem and add to the application's Gemfile by executing:
8+
9+
$ bundle add rs-result
10+
11+
If bundler is not being used to manage dependencies, install the gem by executing:
12+
13+
$ gem install rs-result
14+
15+
## Usage
16+
17+
```ruby
18+
require "rs/result"
19+
20+
```
21+
## Development
22+
23+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24+
25+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26+
27+
## Contributing
28+
29+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rs-result.

Rakefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
require "bundler/gem_tasks"
4+
require "rspec/core/rake_task"
5+
6+
RSpec::Core::RakeTask.new(:spec)
7+
8+
require "rubocop/rake_task"
9+
10+
RuboCop::RakeTask.new
11+
12+
task default: [:spec, :rubocop]

bin/console

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "bundler/setup"
5+
require "rs/result"
6+
7+
# You can add fixtures and/or initialization code here to make experimenting
8+
# with your gem easier. You can also use a different console, if you like.
9+
10+
require "irb"
11+
IRB.start(__FILE__)

0 commit comments

Comments
 (0)