<commit_before>module Lighter
  class LampControl

    def initialize(opts = {})
      # Connect to the server and save the socket
      @sock = opts[:socket]
    end

    def fade(lamps, length, cols)
      send(fadeData(lamps,length,cols))
    end

    def set(lamps, cols)
      send(setData(lamps, cols))
    end

    private

    def mode(lamps, mode)
      raise ArgumentError if lamps < 0 || lamps > 4
      (lamps << 5) | mode
    end

    def send(bytes)
      @sock.puts(bytes.pack("C*"))
    end

    def fadeData(lamps, length, cols)
      [mode(lamps,FADE), cols[0].to_i, cols[1].to_i, cols[2].to_i, length]
    end

    def setData(lamps, cols)
      [mode(lamps,SET), cols[0].to_i, cols[1].to_i, cols[2].to_i]
    end
  end

end<commit_msg>Refactor arrays with splat (*)<commit_after>module Lighter
  class LampControl

    def initialize(opts = {})
      # Connect to the server and save the socket
      @sock = opts[:socket]
    end

    def fade(lamps, length, cols)
      send(fadeData(lamps,length,cols))
    end

    def set(lamps, cols)
      send(setData(lamps, cols))
    end

    private

    def mode(lamps, mode)
      raise ArgumentError if lamps < 0 || lamps > 4
      (lamps << 5) | mode
    end

    def send(bytes)
      @sock.puts(bytes.pack("C*"))
    end

    def fadeData(lamps, length, cols)
      [mode(lamps,FADE), *cols, length]
    end

    def setData(lamps, cols)
      [mode(lamps,SET), *cols]
    end
  end

end
{'fraction_non_alphanumeric': 0.12285518188057652, 'fraction_numerical': 0.008236101578586136, 'mean_word_length': 2.4964028776978417, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1851215', 'n_tokens_mistral': 556, 'n_tokens_neox': 528, 'n_words': 135}