case 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +10 -10
  2. data/Rakefile +1 -1
  3. metadata +2 -2
@@ -4,11 +4,11 @@ The case gem is a power-up for Ruby's case-matching.
4
4
 
5
5
  == Structs
6
6
 
7
- <code>Case::Struct</code> is a subclass of Ruby's standard <code>Struct</code>
8
- class that supports structural matching. When two instances of a normal Ruby
9
- <code>Struct</code> are matched, their fields are compared using the normal
10
- equality test. <code>Case::Struct</code> uses the case-matching
11
- <code>===</code> operator instead.
7
+ <code>Case::Struct</code> is a specialization of Ruby's standard
8
+ <code>Struct</code> class which supports structural matching. When two
9
+ instances of a normal Ruby <code>Struct</code> are matched, their fields
10
+ are compared using the normal equality test. <code>Case::Struct</code>
11
+ uses the case-matching <code>===</code> operator over each field instead.
12
12
 
13
13
  Here's an example of some of the things which are possible:
14
14
 
@@ -161,13 +161,13 @@ The <, >, >= and <= operators are all supported.
161
161
 
162
162
  == Guards
163
163
 
164
- More general tests can be put in when statements using <code>Case::Guard</code>.
164
+ More general tests can be put in when statements using <code>Case.guard</code>.
165
165
 
166
166
  require 'case'
167
167
 
168
168
  ["foobar", "beef", "lorem"].each do |value|
169
169
  case value
170
- when Case::Guard.new { |v| v[1, 1] == "o" }
170
+ when Case.guard { |v| v[1, 1] == "o" }
171
171
  puts "second letter in #{value} is o"
172
172
  else
173
173
  puts "just got #{value}"
@@ -182,19 +182,19 @@ This will print:
182
182
 
183
183
  (Yes, I realize a regular expression could be used for this purpose.)
184
184
 
185
- In simple cases, when <code>Case::Guard</code> is being used directly, you
185
+ In simple cases, when <code>Case.guard</code> is being used directly, you
186
186
  don't even need to bother with the block parameter:
187
187
 
188
188
  ["foobar", "beef", "lorem"].each do |value|
189
189
  case value
190
- when Case::Guard.new { value[1, 1] == "o" }
190
+ when Case.guard { value[1, 1] == "o" }
191
191
  puts "second letter in #{value} is o"
192
192
  else
193
193
  puts "just got #{value}"
194
194
  end
195
195
  end
196
196
 
197
- (The parameter is really only there for when <code>Case::Guard</code> is
197
+ (The parameter is really only there for when <code>Case.guard</code> is
198
198
  being used as part of a larger expression.)
199
199
 
200
200
  == Negation
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/rdoctask'
4
4
  require 'rake/gempackagetask'
5
5
  require 'rake/clean'
6
6
 
7
- GEM_VERSION = "0.5.1"
7
+ GEM_VERSION = "0.5.2"
8
8
 
9
9
  Rake::RDocTask.new do |task|
10
10
  task.rdoc_files.add [ 'lib/**/*.rb', 'README.rdoc' ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MenTaLguY <mental@rydia.net>
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-12-09 00:00:00 -08:00
12
+ date: 2010-12-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15