Module: LIRC::Commands

Defined in:
lib/lirc/commands.rb

Defined Under Namespace

Modules: Base Classes: DrvOption, List, SendOnce, SendStart, SendStop, SetInputlog, SetTransmitters, Simulate

Constant Summary collapse

Version =
Class.new { include Base }

Class Method Summary collapse

Class Method Details

.all_commandsObject



5
6
7
8
9
# File 'lib/lirc/commands.rb', line 5

def self.all_commands
  constants.keep_if do |x|
    const_get(x).instance_of?(Class)
  end.map(&public_method(:serialize_command_name))
end

.serialize_command_name(klass) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/lirc/commands.rb', line 11

def self.serialize_command_name(klass)
  klass = klass.to_s.split(":").fetch(-1)
  rest = klass[1..-1].gsub(/[A-Z]/) do |chr|
    "_#{chr}"
  end
  "#{klass[0]}#{rest.upcase}"
end