Sha256: 89d7b45d265e90af8edbf8752ed66bc8f5ef746d08891001918b1a582dfc493a
Contents?: true
Size: 569 Bytes
Versions: 1
Compression:
Stored size: 569 Bytes
Contents
module Kerplutz class CommandMap attr_reader :commands def initialize @commands = {} end def add(command) commands[command.display_name] = command end def <<(command) add(command) and return self end def [](display_name) commands[display_name] end def ===(display_name) commands.has_key?(display_name) end def summary(indent=2) commands.inject("") do |acc, (display_name, command)| acc << " " * indent << "#{display_name} #{command.desc}\n" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kerplutz-0.1.0 | lib/kerplutz/command_map.rb |