• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14module ScriptModule
15    def paramOf(*args)
16        Proc.new {
17            args
18        }
19    end
20
21    def paramGroupsConcat(*every)
22        Proc.new {
23            ans = []
24            every.each { |e|
25                ans.cocnat(e.())
26            }
27            ans
28        }
29    end
30
31    def emptyRest
32        Proc.new {
33            [[]]
34        }
35    end
36
37    def combinationRest(*a)
38        Proc.new {
39            (0..a.size).collect { |i|
40                a.combination(i).to_a
41            }.flatten(1)
42        }
43    end
44
45    def Inifinity
46        "Infinity"
47    end
48
49    def NaN
50        "NaN"
51    end
52
53    def undefined
54        "undefined"
55    end
56end
57
58class Vars < OpenStruct
59    include ScriptModule
60end
61