trither 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 34ea63d76d95c6a027ec109a9ac9eadfb304f92e
4
- data.tar.gz: 13a7149040a45cead9febb232303f2bafc0e31de
3
+ metadata.gz: d2ec9d8bb76073063a74ecad037545bf191d6432
4
+ data.tar.gz: c81beeaea402eeb77acecc33b7484fe2fdc2eb5d
5
5
  SHA512:
6
- metadata.gz: 993cb30ff85146ef4d7f3f48b609b5f1f959ff4beb739a5ee0330d8d75ebf0d3d9b4a39f40b7fad5b5a4d0b0458ceb4bc6ce4c696f3112d0717381b899016320
7
- data.tar.gz: a24b0b2a1370e4269578e526de11a04c79c599f2c7749deb7900fbe6b94cd32764ba13a4a974c90926f386e48328b6c5152cf29a522bad1c9f85428d516bd772
6
+ metadata.gz: afeb84a64f378477e98ab3deeff6d88124a4da170a50c050c0adff317cb161f0780640518c5d87b85248cbef3adc3e1582061c759bcd93f1bfc84fa0374c755b
7
+ data.tar.gz: 45f9d9d7b3311e63ebca3b7911260232181a67799cd83f8807e15d8c3b3fa028fbb422da3a69cd0997e7c9ce9c0a5434699d2899b0a5e0e4a735980a3ee2bea3
@@ -23,6 +23,10 @@ module Option
23
23
  def self.flat_map
24
24
  self
25
25
  end
26
+
27
+ def self.get_or_else
28
+ yield
29
+ end
26
30
  end
27
31
 
28
32
  class Some
@@ -50,5 +54,9 @@ module Option
50
54
  result
51
55
  end
52
56
  end
57
+
58
+ def get_or_else
59
+ @value
60
+ end
53
61
  end
54
62
  end
data/lib/trither/try.rb CHANGED
@@ -1,4 +1,10 @@
1
1
  module Try
2
+ def self.make
3
+ Success.new(yield)
4
+ rescue StandardError => error
5
+ Failure.new(error)
6
+ end
7
+
2
8
  class Base
3
9
  def initialize(value)
4
10
  @value = value
@@ -1,3 +1,3 @@
1
1
  module Trither
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trither
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyall Jonathan Di Trapani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-24 00:00:00.000000000 Z
11
+ date: 2016-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler