<commit_before>#!/usr/bin/env ruby
%w(net/telnet).each{|r| require r}

class Projector
  attr_accessor :address
  def initialize(address)
    @address = address
  end
  def command(cmd)
    cmd = "%1"+cmd
    s = Net::Telnet.new("Host"=>@address, "Port"=>4352, "Telnetmode"=> false, "Prompt"=>/%1/)
      s.write(cmd+"\r")
      response = s.waitfor("Prompt"=>/%1/).sub(/^PJLINK 0#{cmd}=/,"")
    s.close
    return response
  end

  def power_on
    command("POWR 1")
    puts "* Power On sent"
  end
  def power_off
     command("POWR 0")
     puts "* Power Off sent"
  end
  def input(input)
    if self.input_list.include?(input)
      command("INPT #{input}")
    end
    puts "* Switch to input #{input} sent"
  end
  def vmute_on
    command("AVMT 11")
    puts "* Video mute on sent"
  end
  def vmute_off
    command("AVMT 10")
    puts "* Video mute off sent"
  end
  def mute_on
    command("AVMT 21")
    puts "* Audio mute on sent"
  end
  def mute_off
    command("AVMT 20")
    puts "* Audio mute off sent"
  end
  def avmute_on
    command("AVMT 31")
    puts "* Audio/video mute on sent"
  end
  def avmute_off
    command("AVMT 30")
    puts "* Audio/video mute off sent"
  end
   
  def power_status
    case command("POWR ?")
      when "0"
        return "Standby"
      when "1"
        return "Power On"
      when "2"
        return "Cooling Down"
      when "3"
        return "Warming Up"
      end
  end 
  def lamp_hours
    return command("LAMP ?").scan(/(\d+ \d)/).map{|i| i[0].split[0].to_i}
  end
  def device_name
    return command("NAME ?")
  end
  def manufacturer_name
    return command("INF1 ?")
  end
  def product_name
    return command("INF2 ?")
  end
  def input_list
    return command("INST ?").split.sort
  end
  def mute_status
    return command("AVMT ?")
  end
  
  private :command
end<commit_msg>Implemented "PJLink Class" and "Other Info" queries<commit_after>#!/usr/bin/env ruby
%w(net/telnet).each{|r| require r}

class Projector
  attr_accessor :address
  def initialize(address)
    @address = address
  end
  def command(cmd)
    cmd = "%1"+cmd
    s = Net::Telnet.new("Host"=>@address, "Port"=>4352, "Telnetmode"=> false, "Prompt"=>/%1/)
      s.write(cmd+"\r")
      response = s.waitfor("Prompt"=>/%1/).sub(/^PJLINK 0#{cmd}=/,"")
    s.close
    return response
  end

  def power_on
    command("POWR 1")
    puts "* Power On sent"
  end
  def power_off
     command("POWR 0")
     puts "* Power Off sent"
  end
  def input(input)
    if self.input_list.include?(input)
      command("INPT #{input}")
    end
    puts "* Switch to input #{input} sent"
  end
  def vmute_on
    command("AVMT 11")
    puts "* Video mute on sent"
  end
  def vmute_off
    command("AVMT 10")
    puts "* Video mute off sent"
  end
  def mute_on
    command("AVMT 21")
    puts "* Audio mute on sent"
  end
  def mute_off
    command("AVMT 20")
    puts "* Audio mute off sent"
  end
  def avmute_on
    command("AVMT 31")
    puts "* Audio/video mute on sent"
  end
  def avmute_off
    command("AVMT 30")
    puts "* Audio/video mute off sent"
  end
   
  def power_status
    case command("POWR ?")
      when "0"
        return "Standby"
      when "1"
        return "Power On"
      when "2"
        return "Cooling Down"
      when "3"
        return "Warming Up"
      end
  end 
  def lamp_hours
    return command("LAMP ?").scan(/(\d+ \d)/).map{|i| i[0].split[0].to_i}
  end
  def device_name
    return command("NAME ?")
  end
  def manufacturer_name
    return command("INF1 ?")
  end
  def product_name
    return command("INF2 ?")
  end
  def input_list
    return command("INST ?").split.sort
  end
  def mute_status
    return command("AVMT ?")
  end
  def pjlink_class
    return command("CLSS ?")
  end
  def other_info
    return command("INFO ?")
  end
  
  private :command
end
{'fraction_non_alphanumeric': 0.13020833333333334, 'fraction_numerical': 0.015625, 'mean_word_length': 2.533578656853726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2902514', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1384, 'n_words': 387}