Class: Cmdserver::Settings
- Inherits:
-
Object
- Object
- Cmdserver::Settings
- Defined in:
- lib/cmdserver.rb
Overview
{{{
Direct Known Subclasses
Instance Attribute Summary collapse
-
#module_dir ⇒ Object
readonly
Returns the value of attribute module_dir.
-
#workdir ⇒ Object
readonly
Returns the value of attribute workdir.
Instance Method Summary collapse
-
#initialize(work_dir = "~/.cmdserver/") ⇒ Settings
constructor
A new instance of Settings.
- #load_modules ⇒ Object
Constructor Details
#initialize(work_dir = "~/.cmdserver/") ⇒ Settings
Returns a new instance of Settings.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cmdserver.rb', line 15 def initialize(work_dir="~/.cmdserver/") @workdir = Pathname.new(File.(work_dir)) @module_dir = @workdir + "modules" if not @workdir.exist? Dir.mkdir @workdir end if not @module_dir.exist? Dir.mkdir @module_dir end # load_modules is now being called by the # TCPCommandServer class end |
Instance Attribute Details
#module_dir ⇒ Object (readonly)
Returns the value of attribute module_dir.
12 13 14 |
# File 'lib/cmdserver.rb', line 12 def module_dir @module_dir end |
#workdir ⇒ Object (readonly)
Returns the value of attribute workdir.
13 14 15 |
# File 'lib/cmdserver.rb', line 13 def workdir @workdir end |
Instance Method Details
#load_modules ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/cmdserver.rb', line 28 def load_modules Dir.glob("#{@module_dir}/**/*.rb").each do |mod| Cmdserver::Cmdprotocol.extend_protocol() puts "Loading module: #{mod}" require mod end end |