Top Level Namespace
Defined Under Namespace
Modules: TreeSitter, TreeStand
Instance Method Summary collapse
-
#array_split_like_rust(array) ⇒ Object
splits an array like [rust](doc.rust-lang.org/std/primitive.slice.html#method.split).
- #env_var_on?(var) ⇒ Boolean
- #system_tree_sitter? ⇒ Boolean
Instance Method Details
#array_split_like_rust(array) ⇒ Object
splits an array like [rust](doc.rust-lang.org/std/primitive.slice.html#method.split)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tree_sitter/helpers.rb', line 4 def array_split_like_rust(array, &) return enum_for(__method__, array) if !block_given? return [] if array.empty? result = [] current_slice = [] array.each do |element| if yield(element) result << current_slice current_slice = [] else current_slice << element end end result << current_slice result end |
#env_var_on?(var) ⇒ Boolean
21 22 23 |
# File 'ext/tree_sitter/extconf.rb', line 21 def env_var_on?(var) %w[1 on true t yes y].include?(ENV.fetch(var, '').downcase) end |
#system_tree_sitter? ⇒ Boolean
17 18 19 |
# File 'ext/tree_sitter/extconf.rb', line 17 def system_tree_sitter? enable_config('sys-libs', false) end |