kase 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb95aeef3f46aa01ab47195d790334819f152863
4
- data.tar.gz: 4018d1351703b1507e7e18b353aeff417ecf9b30
3
+ metadata.gz: bb222da1a962d8afccb1b98556a72e2e4160897e
4
+ data.tar.gz: 6b10ed97e49ae29112a432bc84fbda91171980c8
5
5
  SHA512:
6
- metadata.gz: 830b147275360417dcffca01086ced94eef2f7f3de01ab673356ff43f50fbd217775614560a9835e2819fe1d34671ac54761876d736807437a8835b7952dc1b1
7
- data.tar.gz: f9615f5128d39c6469fbff6c174c9b3cb395a53b507baf975a6a4487e86932fff24e2d9291ca9c5582e10b915f13436ff9edd94c4a0099a3b35a94810a770440
6
+ metadata.gz: c1fb61b66deed365819d02994d2384b83c5ebfc687297c04c6b5a9349efde4e4a56b63e71deb129eceb0f8bdf8f9c286900e608f01acb33a14b1603577fc3a39
7
+ data.tar.gz: 8027035e607c4df711bbc2a07b55e01e6a207aa039371df62a66f64842e2a579242dd5ddf12ef61a2b12ff7c07c9f62dbdb8da15b047a47284cc27640c3313a1
data/.travis.yml CHANGED
@@ -2,3 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 2.3.0
4
4
  before_install: gem install bundler -v 1.11.2
5
+ script: bundle exec rspec
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Next
2
+
3
+ * (Your contributions here)
4
+
5
+ # Version 0.1.1 (2016-04-02)
6
+
7
+ * Added error message to NoMatchError, [hosh](https://github.com/hosh)
8
+
9
+ # Version 0.1.0 (2016-03-31)
10
+
11
+ * Initial version, [lasseebert](https://github.com/lasseebert)
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Kase
2
2
 
3
- Kase gracefully handles `[status, result]`-like return values from methods.
3
+ Kase gracefully pattern matches `[:ok, result]`-like return values.
4
4
 
5
5
  It is a tool to avoid using exceptions as flow control and to write safer and
6
6
  more readable code.
7
7
 
8
+ [![Gem Version](https://badge.fury.io/rb/kase.svg)](https://badge.fury.io/rb/kase)
9
+ [![Build Status](https://travis-ci.org/lasseebert/kase.svg?branch=master)](https://travis-ci.org/lasseebert/kase)
10
+
8
11
  ## Introduction
9
12
 
10
13
  The idea is inspired by Elixir in which many functions returns something like
@@ -72,7 +75,7 @@ end
72
75
 
73
76
  This is much more easy to read and reason about.
74
77
 
75
- See below for more a full list of what Kase does.
78
+ See below for a full list of what Kase does.
76
79
 
77
80
  ## Installation
78
81
 
@@ -250,7 +253,7 @@ Note that `#kase` is aliased to `#call` so you can use the shorthand
250
253
 
251
254
  ## Development
252
255
 
253
- * Install dependencies with `bundle`
256
+ * Install development dependencies with `bundle`
254
257
  * Run specs with `bundle exec rspec`
255
258
 
256
259
  ## Contributing
@@ -264,12 +267,21 @@ contributors are expected to adhere to the
264
267
 
265
268
  ### Pull requests
266
269
 
267
- To make a pull request:
270
+ A pull request should consist of
271
+
272
+ * At least one failing test that proves the bug or documents the feature.
273
+ * The implementation of the bugfix or feature
274
+ * A line in the `CHANGELOG.md` with a description of the change, a link to the pull
275
+ request and a link to your github user.
276
+
277
+ ## Contact
278
+
279
+ Find me on twitter: [@lasseebert](https://twitter.com/lasseebert)
280
+
281
+ ## Alternatives
268
282
 
269
- 1. Fork the project
270
- 2. Make at least one failing test that proves the bug or describes the feature.
271
- 3. Implement bugfix or feature
272
- 4. Make pull request
283
+ * [Noadi](https://github.com/katafrakt/noaidi) mimics the functional pattern
284
+ matching of Elixir and might be used as an alternative of Kase.
273
285
 
274
286
  ## License
275
287
 
data/lib/kase/switcher.rb CHANGED
@@ -29,7 +29,7 @@ module Kase
29
29
  end
30
30
 
31
31
  def validate!
32
- raise NoMatchError unless matched?
32
+ raise NoMatchError.new(values) unless matched?
33
33
  true
34
34
  end
35
35
 
data/lib/kase/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kase
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/kase.rb CHANGED
@@ -9,7 +9,7 @@ module Kase
9
9
  end
10
10
  alias_method :call, :kase
11
11
 
12
- def ok!(*values, &block)
12
+ def ok!(*values, &_block)
13
13
  Switcher.new(*values).switch do
14
14
  on(:ok) do |*result|
15
15
  if block_given?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Skindstad Ebert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2016-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
78
  - ".travis.yml"
79
+ - CHANGELOG.md
79
80
  - CODE_OF_CONDUCT.md
80
81
  - Gemfile
81
82
  - LICENSE.txt