filigree 0.3.1 → 0.3.2

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: 3c9911e71c1aab6f164a4f49af71b888f9f17f63
4
- data.tar.gz: dda61f8f3d3181d3787d364cf54df9a716fa9b5a
3
+ metadata.gz: 508a55d16a4f1321ba4c9042758b1a497bf85827
4
+ data.tar.gz: d5ce1b0d135d319bb5a20425bf74ce6d8ade72c9
5
5
  SHA512:
6
- metadata.gz: be44708b88b56c8e6d654a11e5a343319dcf14283154fdcd7acd7b33c6c125c9211b6e8e5bfa44c37c8beb51f34ccb36fbce8440251e5c0728143ccad95c0c68
7
- data.tar.gz: 1591d525b1bbfde2709a5180ab7fd51d13a0e507036c19f73a89824798ac7e2091099fa39b9240b8939cec8dad2ccd9e41cc470fe0c4365da6f4cd4457b1663c
6
+ metadata.gz: b0683038d43739552cd653c997fd28b8c1f435db879166bc2c50475817528fb8061ef2b5fd11c3c948b8c005e237ab6d81d24963e77d8ca0b60534cb6af8eead
7
+ data.tar.gz: 1bc7acb9d54d99a95ff8229c384d57b3929e6ab24b3478fbe6ebeb19888d4339c6f058ca39bbc078db452f568f69c011cb46874d90b27819abbbeb4f0c3c8411
data/README.md CHANGED
@@ -73,7 +73,7 @@ The most basic pattern is the literal. Here, the object or objects being matche
73
73
  foo(42) # => :other
74
74
  ```
75
75
 
76
- You may also match against variables. This can sometimes conflict with the next kind of pattern, which is a binding pattern. Here, the pattern will match any object, and then make the object it matched available to the *with block* via an attribute reader. This is accomplished using the method_missing callback, so if there is a variable or function with that name you might accidentally compare against a variable or returned value. To bind to a name that is already in scope you can use either the {Filigree::MatchEnvironment#Bind} method or the `!` Symbol method. In addition, class and destructuring pattern results (see bellow) can be bound to a variable by using the {Filigree::BasicPattern#as} method.
76
+ You may also match against variables. This can sometimes conflict with the next kind of pattern, which is a binding pattern. Here, the pattern will match any object, and then make the object it matched available to the *with block* via an attribute reader. This is accomplished using the method_missing callback, so if there is a variable or function with that name you might accidentally compare against a variable or returned value. To bind to a name that is already in scope you can use either the {Filigree::MatchEnvironment#Bind} method or the `~` Symbol method. In addition, class and destructuring pattern results (see bellow) can be bound to a variable by using the {Filigree::BasicPattern#as} method.
77
77
 
78
78
  ```Ruby
79
79
  var = 42
@@ -94,7 +94,7 @@ x = 3
94
94
  match 42 do
95
95
  with(Bind(:x)) { x }
96
96
  # Equivalent to the line above.
97
- with(!:x) { x }
97
+ with(~:x) { x }
98
98
  with(42) { :hoopy }
99
99
  end
100
100
  ```
@@ -662,7 +662,7 @@ class Symbol
662
662
  # Turns a symbol into a binding pattern.
663
663
  #
664
664
  # @return [Filigree::BindingPattern]
665
- def !
665
+ def ~
666
666
  Filigree::BindingPattern.new(self)
667
667
  end
668
668
  end
@@ -4,5 +4,5 @@
4
4
  # Description: This file specifies the version number of Filigree.
5
5
 
6
6
  module Filigree
7
- VERSION = '0.3.1'
7
+ VERSION = '0.3.2'
8
8
  end
@@ -111,11 +111,11 @@ class MatchTester < Minitest::Test
111
111
  end
112
112
  end
113
113
 
114
- def match_tester_bang_bind(o)
114
+ def match_tester_squiggle_bind(o)
115
115
  match o do
116
- with(Fixnum.as(!:a)) { [:Fixnum, a] }
117
- with(Float.as(!:a)) { [:Float, a] }
118
- with(String.as(!:a)) { [:String, a] }
116
+ with(Fixnum.as(~:a)) { [:Fixnum, a] }
117
+ with(Float.as(~:a)) { [:Float, a] }
118
+ with(String.as(~:a)) { [:String, a] }
119
119
  end
120
120
  end
121
121
 
@@ -239,10 +239,10 @@ class MatchTester < Minitest::Test
239
239
  assert_equal :Regexp, match_tester_literal(/a/)
240
240
  end
241
241
 
242
- def test_bang_bind
243
- assert_equal [:Fixnum, 42], match_tester_bang_bind(42)
244
- assert_equal [:Float, 42.0], match_tester_bang_bind(42.0)
245
- assert_equal [:String, 'foo'], match_tester_bang_bind('foo')
242
+ def test_squiggle_bind
243
+ assert_equal [:Fixnum, 42], match_tester_squiggle_bind(42)
244
+ assert_equal [:Float, 42.0], match_tester_squiggle_bind(42.0)
245
+ assert_equal [:String, 'foo'], match_tester_squiggle_bind('foo')
246
246
  end
247
247
 
248
248
  def test_manual_bind
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filigree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wailes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler