Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean up code examples (OCD)

  • Loading branch information...
commit 90bc36329eaa29bc06134d7346baaf3757184367 1 parent 00a2a0a
@ConradIrwin ConradIrwin authored
Showing with 10 additions and 6 deletions.
  1. +5 −3 README.markdown
  2. +5 −3 lib/ampex.rb
View
8 README.markdown
@@ -37,9 +37,11 @@ You can use this in any place a block is expected, for example to create a lambd
Last but definitly not least you can use this as a target for `when` like this
- case( something )
- when X.respond_to? :foo then "something responds to :foo"
- when X.kind_of? Hash then "something is a Hash"
+ case something
+ when X.respond_to? :foo
+ something.foo
+ when X.respond_to? :[]
+ something['foo']
end
Gotchas
View
8 lib/ampex.rb
@@ -25,9 +25,11 @@ def initialize(&block)
# This method is here so that a metavariable can be used as a target for "when" like this:
#
- # case( foo )
- # when X.respond_to? :bar then "Responds to :bar"
- # when X.respond_to? :foobar then "Responds to :foobar"
+ # case foo
+ # when X.respond_to? :bar
+ # "Responds to :bar"
+ # when X.respond_to? :foobar
+ # "Responds to :foobar"
# end
#
def ===(y)
Please sign in to comment.
Something went wrong with that request. Please try again.