PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.7
Code Block Pro – Beautiful Syntax Highlighting v1.27.7
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / samples / ruby.sample

ruby.sample in Code Block Pro – Beautiful Syntax Highlighting 1.27.7, at build/shiki/samples/ruby.sample

21 lines 541 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 class LotteryTicket
2
3 NUMERIC_RANGE = 1..25
4
5 attr_reader :picks, :purchased
6
7 def initialize( *picks )
8 if picks.length != 3
9 raise ArgumentError, "three numbers must be picked"
10 elsif picks.uniq.length != 3
11 raise ArgumentError, "the three picks must be different numbers"
12 elsif picks.detect { |p| not NUMERIC_RANGE === p }
13 raise ArgumentError, "the three picks must be numbers between 1 and 25"
14 end
15 @picks = picks
16 @purchased = Time.now
17 end
18
19 end
20
21 # From https://poignant.guide/book/chapter-5.html