algebrick 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/algebrick.rb +20 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6e3ca091c97766d3eb3524ce82f129558386865
4
- data.tar.gz: b4c5547dd1dd6604f57db2b2360e11136f883226
3
+ metadata.gz: c59b78e81ddad7a8982de954309dba01ccc26db9
4
+ data.tar.gz: 94cbecbb1b1bd1f3ca682fa0707439b7afcba7fc
5
5
  SHA512:
6
- metadata.gz: e1bdc83c04dde504c7d9360bea9f3599c2b8e8bd251bd42087c4c1eab574482258f762e1c0444f1b97ffefe49ac7f35beb0eec85ad69cdb443039733a225f7ce
7
- data.tar.gz: 71d61898fdcf3e4b29ada2552ae90527a609355b52841e7236983adc2158c46085db2dfaba155f7eababadfcc268a0c327a8f3ff496738ae60c0ffc7628b29f4
6
+ metadata.gz: aeff2d9b02f3f947f0019c9c915f37194a1c02bc4d20eef4f7365ad22c836c8b4158b10cfc0686f66e9a640bb0cb1dff0cc39c253328ee043926f6dfe9dc851e
7
+ data.tar.gz: d225e46f414574b28ff8719639d1ce193fe12e86935d27a9faef0bcaed2c3003ee2eebaf5eb336bdaf5f697d3f3ab8d24bd84df1e98c69d3f2d3161950b87453
data/README.md CHANGED
@@ -4,4 +4,4 @@ Algebraic types and pattern matching for Ruby.
4
4
 
5
5
  - Documentation: http://blog.pitr.ch/algebrick
6
6
  - Source: https://github.com/pitr-ch/algebrick
7
- - Blog: http://blog.pitr.ch
7
+ - Blog: http://blog.pitr.ch/blog/categories/algebrick/
data/lib/algebrick.rb CHANGED
@@ -120,6 +120,18 @@ module Algebrick
120
120
  def !
121
121
  !to_m
122
122
  end
123
+
124
+ def -(block)
125
+ to_m - block
126
+ end
127
+
128
+ def case(&block)
129
+ to_m.case &block
130
+ end
131
+
132
+ def >>(block)
133
+ to_m >> block
134
+ end
123
135
  end
124
136
 
125
137
  class Type < Module
@@ -374,7 +386,7 @@ module Algebrick
374
386
  self[*fields.map { |value| field_from_hash value }]
375
387
  when Hash
376
388
  self[fields.inject({}) do |h, (name, value)|
377
- raise ArgumentError unless @field_names.map(&:to_s).include? name
389
+ raise ArgumentError unless @field_names.map(&:to_s).include? name.to_s
378
390
  h.update name.to_sym => field_from_hash(value)
379
391
  end]
380
392
  end
@@ -533,12 +545,16 @@ module Algebrick
533
545
  return self, block
534
546
  end
535
547
 
536
- def +(block)
548
+ def -(block)
537
549
  return self, block
538
550
  end
539
551
 
540
- alias_method :-, :+
541
- alias_method :>>, :+
552
+ alias_method :>>, :-
553
+
554
+ def +(block)
555
+ warn 'a_matcher +-> {} is deprecated, it\'ll be removed in 0.2'
556
+ self - block
557
+ end
542
558
 
543
559
  def ~
544
560
  @assign = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algebrick
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
  - Petr Chalupa