File: lambda_literal_pretty.rb

package info (click to toggle)
ruby-beautify 0.97.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 340 kB
  • sloc: ruby: 628; makefile: 8
file content (34 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Test for lambda literal
class ArrowOperator
	def one_liner
		x = -> (x) {x * x}
	end
	def one_liner2args
		x = -> (x, y) {x * y}
	end
	def multiline
		x = -> (x) {
			x * x
		}
	end
	def multiline2args
		x = -> (x, y) {
			x * y
		}
	end
	def omit_braces
		x = -> x {
			x * x
		}
	end
	def omit_braces2args
		x = -> x, y {
			x * y
		}
	end
	def argument_nothing
		x = -> {
			x * x
		}
	end
end