callee 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2317b43e6f267fc9a26f587b91f1bf0bc098b26ee1a4a85833b290f4418175ce
4
- data.tar.gz: b1a7396d2d8855b7517350a04de073f416c1602f4bbe4e5ed04b840771577bfa
3
+ metadata.gz: 5bcafa6587f9210c87ea5156944ca31f979ff3f88967901cbd8dc1a74e17639b
4
+ data.tar.gz: 524208f6a87cd9b00f8984900a25b9d547480ab5b0da48db583a48c244418deb
5
5
  SHA512:
6
- metadata.gz: e069dfb7c0cc73fb69461d202068bb9e69c16c552d45e191d0530ca31d529e11105656ba71f674183b6a9fc93ee256a0badef1ba82da3bb08642eb242b062898
7
- data.tar.gz: f96fbdb129d49169198639bcd2ce02b9e7b73db918131e62841f1601e7ab17215b596cd076cbcc26d461d7051c9f045a7ce173d0b228ca89ec416dbea7af8650
6
+ metadata.gz: e217d93d28711d73f503fd8300125993a08cfbd0c412259eaa7372af83a59dde50c20ee409ca9763543afd05c61ed8e4337443cf28fe1309bf728de06b4db6c1
7
+ data.tar.gz: 5591eab6405a51a363acbd962bfa8947b1cff474f0d8b8aea620cac6b3897cb575aa471f8acd93387078271e88f76433d7d9c898a68255c6b7490b63a3ede599
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.1.0] - 2019-07-07
7
+ ## [0.1.2] - 2019-07-28
8
+
9
+ - Added a readme.
10
+ - Relaxed dependencies.
11
+
12
+ ## [0.1.1] - 2019-07-27
8
13
 
9
14
  - First public release.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- callee (0.1.1)
4
+ callee (0.1.2)
5
5
  dry-initializer (>= 2.5, < 4.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Callee
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/callee`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem helps to define callable classes with strict params specification.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,42 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ To make a class callable, you need to include `Callee` mixin and implement `call` instance method. Use [dry-initializer DSL](https://dry-rb.org/gems/dry-initializer/optionals-and-defaults/) to specify calling parameters and options if necessary. Here is a basic usage example:
24
+
25
+ ``` ruby
26
+ class SumService
27
+ include Callee
28
+
29
+ param :a
30
+ param :b
31
+
32
+ def call
33
+ a + b
34
+ end
35
+ end
36
+
37
+ SumService.call(1, 1) # Will return 2
38
+ ```
39
+
40
+ And one more example, to demonstrate optional params with default values:
41
+
42
+ ``` ruby
43
+ class GreetingService
44
+ include Callee
45
+
46
+ option :greeting, optional: true, default: proc { 'Hello' }
47
+ option :name, optional: true
48
+
49
+ def call
50
+ "#{[greeting, name].compact.join(', ')}!"
51
+ end
52
+ end
53
+
54
+ GreetingService.call # Will return "Hello!"
55
+ GreetingService.call(name: 'Probert') # Will return "Hello, Probert!"
56
+ ```
57
+
58
+ Type constraints and coercion will also work, as usual, just make sure to include `dry-types` (here are [some examples)](https://dry-rb.org/gems/dry-initializer/type-constraints/)).
26
59
 
27
60
  ## Development
28
61
 
@@ -1,3 +1,3 @@
1
1
  module Callee
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Musayev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-27 00:00:00.000000000 Z
11
+ date: 2019-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer