lib/synvert/snippets/ruby/new_lambda_syntax.rb in synvert-0.0.13 vs lib/synvert/snippets/ruby/new_lambda_syntax.rb in synvert-0.0.14
- old
+ new
@@ -1,5 +1,11 @@
-Synvert::Rewriter.new "ruby_new_lambda_syntax", "Ruby uses new lambda syntax" do
+Synvert::Rewriter.new "ruby_new_lambda_syntax" do
+ description <<-EOF
+Use ruby new lambda syntax
+
+ lambda { # do some thing } => -> { # do some thing }
+ EOF
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("1.9.0")
within_files '**/*.rb' do
# lambda { |a, b, c| a + b + c } => ->(a, b, c) { a + b + c }
within_node type: 'block', caller: {type: 'send', message: 'lambda'} do
if node.arguments.empty?