mallow 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,7 +10,7 @@ To mallow it is very easy little boy. First marshal, then mallow:
10
10
 
11
11
  ```ruby
12
12
  mallow = Mallow.build do |match|
13
- match.a_hash.to {"#{keys.first} #{values.first}"}
13
+ match.a(Hash).to {"#{keys.first} #{values.first}"}
14
14
  end
15
15
  ```
16
16
  Now feed your mallow some iterable data:
@@ -18,14 +18,14 @@ Now feed your mallow some iterable data:
18
18
  data = [{:hay => :good_buddy}]
19
19
  mallow.fluff data #=> ["hay good_buddy"]
20
20
  ```
21
- Mallow's DSL has a moderately rich vocabulary of built-in helpers (with complementary method_missing magic if that's yr thing):
21
+ Mallow's DSL has a fairly rich vocabulary of built-in helpers:
22
22
  ```ruby
23
23
  Mallow.build { |match|
24
24
  match.a(Float).to &:to_i
25
25
  match.tuple(3).where{last != 0}.to {|a,b,c| (a + b) / c}
26
26
  match.an(Array).and_hashify_with( :name, :age ).and_make_a( Person ).and &:save!
27
- match.a_fixnum.of_size(8).to {'8bit'}
28
- match.a_string.to_upcase
27
+ match.a(Fixnum).of_size(8).to {'8bit'}
28
+ match.a(String).to{upcase}
29
29
  match.*.to { WILDCARD }
30
30
  }.fluff( data )
31
31
  ```
@@ -46,7 +46,7 @@ Luckily the second reason is that this should be done as part of some kind of po
46
46
  ```ruby
47
47
  doubler = Mallow.build do |m|
48
48
  m.a(Fixnum).^(type: Fixnum).to {|n| n*2}
49
- m.anything.to {nil}.^(matched: false)
49
+ m.*.to {nil}.^(matched: false)
50
50
  end
51
51
 
52
52
  data = doubler.fluff [1,2,:moo] #=> [2, 4, nil]
@@ -1,3 +1,3 @@
1
1
  module Mallow
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -12,6 +12,6 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'http://github.com/gwentacle/mallow'
13
13
  spec.summary = 'Tiny universal data pattern matcher / dispatcher'
14
14
  spec.description = 'Tiny universal data pattern matcher / dispatcher'
15
- spec.add_development_dependency 'graham', '>=0.0.2'
15
+ spec.add_development_dependency 'graham', '>=0.0.3'
16
16
  end
17
17
 
@@ -32,11 +32,11 @@ class Exceptions
32
32
 
33
33
  end
34
34
 
35
- Graham.pp(Cases) {|that|
36
- that.test_case_1.returns_an_array.that_is [ 198, 'ASDF', 'QWER', 15, 94, 'coolstorybro' ]
35
+ Graham.pp(Cases.new) {|that|
36
+ that.test_case_1.returns_an(Array).that_is [ 198, 'ASDF', 'QWER', 15, 94, 'coolstorybro' ]
37
37
  }
38
38
 
39
- Graham.pp(Exceptions) {|that|
39
+ Graham.pp(Exceptions.new) {|that|
40
40
  that.division_by_zero.raises_a ZeroDivisionError
41
41
  that.calling_a_nonexistent_method.raises_a NoMethodError
42
42
  that.an_unmatched_element.raises_a Mallow::MatchException
@@ -5,7 +5,7 @@ class MetaTests
5
5
  end
6
6
  end
7
7
 
8
- Graham.pp(MetaTests) do |that|
8
+ Graham.pp(MetaTests.new) do |that|
9
9
  that.binding_behaviour_with_common_keys.returns meta: :data!, any: :body?
10
10
  end
11
11
 
@@ -36,7 +36,7 @@ class MonadLaws
36
36
  end
37
37
  end
38
38
 
39
- Graham.pp(MonadLaws) {|that|
39
+ Graham.pp(MonadLaws.new) {|that|
40
40
  that.RuleLeftIdentity.is true
41
41
  that.RuleRightIdentity.is true
42
42
  that.RuleAssociativity.is true
@@ -39,7 +39,7 @@ class RuleTests
39
39
  end
40
40
  end
41
41
 
42
- Graham.pp(RuleTests) do |that|
42
+ Graham.pp(RuleTests.new) do |that|
43
43
  that.unwrapping_an_empty_rule.raises_a Mallow::MatchException
44
44
  that.unwrapping_a_failing_rule.raises_a Mallow::MatchException
45
45
  that.unwrapping_a_passing_rule.returns_a(Mallow::Meta).such_that { val == :value }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mallow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graham
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.2
21
+ version: 0.0.3
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.2
29
+ version: 0.0.3
30
30
  description: Tiny universal data pattern matcher / dispatcher
31
31
  email: feivel@sdf.org
32
32
  executables: []