File indexing completed on 2024-11-24 03:39:37
0001 v.setCursorPosition(3, 25); 0002 v.enter(); 0003 v.enter(); 0004 0005 // basic method definitions 0006 v.type("def self.call(...) = new(...).call"); 0007 v.enter(); 0008 v.enter(); 0009 0010 v.type("def call = raise NotImplementedError"); 0011 v.enter(); 0012 v.enter(); 0013 0014 v.type("def call() = :endless"); 0015 v.enter(); 0016 v.enter(); 0017 0018 v.type("def compact? =true"); 0019 v.enter(); 0020 v.enter(); 0021 0022 // default parameters 0023 v.type("def expand ( ts = Time.now ) = ts.year * (rand * 1000)") 0024 v.enter(); 0025 v.enter(); 0026 0027 v.type("def foo(bar = \"baz\")"); 0028 v.enter(); 0029 v.type("bar.upcase"); 0030 v.enter(); 0031 v.type("end"); 0032 v.enter(); 0033 v.enter(); 0034 0035 v.type("def foo_blank bar = \"baz\""); 0036 v.enter(); 0037 v.type("bar.upcase"); 0038 v.enter(); 0039 v.type("end"); 0040 v.enter(); 0041 v.enter(); 0042 0043 // default parameters, but endless (parenthesis are required around the params now) 0044 v.type("def foo_endless(bar = \"baz\") = bar.upcase"); 0045 v.enter(); 0046 v.enter(); 0047 0048 // setter methods can't be endless, make sure the `=` of the method name doesn't get picked up as such 0049 v.type("def width=(other)") 0050 v.enter(); 0051 v.type("@width = other"); 0052 v.enter(); 0053 v.type("end"); 0054 v.enter(); 0055 v.enter(); 0056 0057 v.type("def height= other") 0058 v.enter(); 0059 v.type("@height = other"); 0060 v.enter(); 0061 v.type("end"); 0062 v.enter();