Class: Billy::Commands
- Inherits:
-
Object
- Object
- Billy::Commands
- Defined in:
- lib/billy/commands.rb,
lib/billy/commands/my.rb,
lib/billy/commands/eat.rb,
lib/billy/commands/walk.rb,
lib/billy/commands/hello.rb,
lib/billy/commands/config.rb,
lib/billy/commands/command.rb
Defined Under Namespace
Classes: Command, Config, Eat, Hello, My, Walk
Class Attribute Summary collapse
-
.pool ⇒ Object
Returns the value of attribute pool.
Class Method Summary collapse
Class Attribute Details
.pool ⇒ Object
Returns the value of attribute pool.
6 7 8 |
# File 'lib/billy/commands.rb', line 6 def pool @pool end |
Class Method Details
.load_pool! ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/billy/commands.rb', line 8 def load_pool! self.pool ||= Hash.new commands_path = File.( File.dirname(__FILE__) + '/commands/**/*.rb' ) Dir[ commands_path ].each do |file| require file end end |
.register_command!(command) ⇒ Object
16 17 18 19 |
# File 'lib/billy/commands.rb', line 16 def register_command!( command ) load_pool! unless !pool.nil? ( pool[ command.name ] = command ) unless pool.values.include?( command ) end |